Problem With Paypal Integration And Ipn (Instant Payment Notification)

Hello guys,

I am creating PayPal pays for first time.

Right now I want to do it according this article: PayPal Integration And IPN (Instant Payment Notification)

link to article: http://www.yiiframework.com/wiki/433/paypal-payment-and-ipn-instant-payment-notification/#add-comment

What I want?

I am offering 3 types of Premium package on my site. User can choose one and pay it through PayPal. When it is payed I will change some informations in specific user.

So I need PayPal where custom field will be Order ID (from Order I know which User did the Order). After click on "Pay by PayPal" it will be redirected to PayPal page where will be priceā€¦ After that I need to receive information if Order was payed or not - so I need IPN.

My questions to that article.


// Define LIVE constant as true if 'localhost' is not present in the host name. Configure the detecting of environment as necessary of course.

defined('LIVE') || define('LIVE', strpos($_SERVER['HTTP_HOST'],'localhost')===false ? true : false);

if (LIVE) {

  define('PAYPAL_SANDBOX',false);

  define('PAYPAL_HOST', 'ipnpb.paypal.com');

  define('PAYPAL_URL', 'https://ipnpb.paypal.com/cgi-bin/webscr');

  define('PAYPAL_EMAIL',''); // live email of merchant

}else{

  define('PAYPAL_HOST', 'www.sandbox.paypal.com');

  define('PAYPAL_URL', 'https://www.sandbox.paypal.com/uk/cgi-bin/webscr');

  define('PAYPAL_EMAIL', ''); // dev email of merchant

  define('PAYPAL_SANDBOX',true);

}



my config/main.php


return array {

//here is all settings

}

so that code should be out of array or where? How it should look?

And second question to this block is: dev email of merchant is my email which I used to register on PayPal or email of Test Acount?

Can I test IPN from my localhost?

From view file I confused with this block




$.post(Yii::app()->getRequest()->getBaseUrl().'order/create'; ?>',$('#orderForm').serializeArray(),function(orderResp) {

            if(orderResp.error === undefined){

                var action;

                $('#paypalOrderId').val(orderResp.id);

                $('#orderForm').attr({action:'<?php echo PAYPAL_URL?>',onsubmit:true}).submit();

            }else{

                alert(orderResp.error);

            }

        },'json');



why is there ?>? Where it started? And how should looks Create action in OrderController? I have never created new record like this.

So the result of my post is that I need step by step what I should do when I want to create PayPal pays. Maybe after I will do it I can make article step by step with all steps (also configuration in PayPal)

Thank you for all answers