Tutorial :Paypal IPN call back with parameter [duplicate]



Question:

Possible Duplicate:
Can I send a variable to paypal, and have it post it back to me when payment completes?

I want to automate a process after user have made a payment.

1) User enter details on forms and submit, the session will pass unique ID to paypal 2) After user complete the paypal payment, unique ID is then pass back to my server for the script to read and register into db.

How do I do that?


Solution:1

I've personally used Micah Carrick's Paypal IPN class.

When the user submits the form and the ID is generated, you can instantiate the class and do something like this:

$paypal = new paypal_class;  $paypal->add_field('business', YOUR EMAIL);  $paypal->add_field('notify_url', URL OF PROCESSING SCRIPT);  $paypal->add_field('item_name', ITEM NAME);  $paypal->add_field('amount', PRICE);  $paypal->add_field('currency_code', USD or GBP etc);  $paypal->add_field('custom', ID FROM DB INSERT);  $paypal->submit_paypal_post();  

The custom field is the most important one for your purpose, you can put whatever you want here and it'll be returned with the IPN call to the notify_url script you have set.

On this notification page, you can validate the IPN call and retrieve the custom variable to do what you want with it...

$paypal = new paypal_class;  if ($paypal->validate_ipn()) {      $id = $paypal->ipn_data['custom'];  }  

Remember to enable IPN callbacks in your Paypal account.


Solution:2

Unfortunately your simple question doesn't do justice to the task at hand. I recommend looking into PayPal's IPN documentation, checking out the PayPal IPN PHP sample code (or Googling for IPN classes people have built). You'll also likely need to test the code using PayPal Developers' IPN Simulator Tool.

... and last but not least, there's various configurations you need to set in your actual PayPal merchant account, so it's worth taking some to understand what's there.

I recently did all this for the first time. I wish it was as easy as plug & play & start receiving money. It's not.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »