为了生成序列,我如何与PayPal IPN进行适当的交互?

Having a bit of trouble with the PayPal IPN. I've seen variations on these questions listed about a million times, but not the answers I'm looking for. As usual this may be a case of asking a question regarding the wrong thing, but I'm hoping there are some super geniuses out there that can assist.

Anyway, I basically need to set up the purchase of some readily available software, and, once the transaction is complete send them a serial. One would think this is simple, but given the criteria it has proven anything but. Basically the steps are as follows:

1) Custom form on website to enter personal (but not too =P) info

2) Forward them to PayPal site to make purchase

3) Upon successful transaction AUTOMATICALLY send them to a serial page and/or send an email with the registration.

I've looked at various IPN classes (using PHP btw) and nothing seems very straightforward, and it doesn't seem that PayPal likes any kind of custom variables being passed, nor does it seem to automatically send someone elsewhere after the purchase. Also, which ID should I be looking at if/when the process finally does come back around?

Perhaps I need the "Pro" account? In any event, please make no assumptions regarding my knowledge of PayPal IPN. I'd simply like a class (hopefully one I haven't tried already) or at least some more straightforward (and concise) documentation on how to accomplish this.

Best.

EDIT #1:

Does anyone have any information on enabling the QUANTITY field during a purchase? For some reason it's stuck at 1 and will not allow a change. I'm not passing anything for quantity atm.

The Paypal API's are kinda known for not being super user-friendly. That said, I have successfully used the IPN API, however, I'm not sure this is what you want to use in your case. IPN (Instant Payment Notification) is 1.) For sending notifications to your server. 2.) It communicates with your server and therefore does not have any effect on a customer's transaction. 3.) Not instant all the time.

So, if you want to send a customer to a certain page, after purchase, you will not be able to accomplish this with IPN. You could start by looking at the Express Checkout API.

If you just need a simple redirect, Paypal provides a way to do this.

You could setup a PHP file on your server, which integrates with IPN. This file would work like this:

  1. IPN sends a "transaction completed" notification to your PHP file.
  2. Your PHP file reads the notification to ensure that it's a "completed transaction notification", as opposed to another notification (such as "transaction failed", etc).
  3. If everything is ok, your PHP file can generate and email out whatever you need to the customer.

I suggest that you use ezimerchant -> www.ezimerchant.com

It's free to sign up. They have an excellent API that allows you to do all that, they hook straight in with paypal so you dont have to bother learning their complex api.

To get you started, you'd use the OrderCreate API, once you signed up you can access the documentation here:

https://api.ezimerchant.com/[merchantid]/orders/edit

Don't forget to add your merchant id.

then it's as simple as supplying a "RETURNURL" and a NOTIFYURL. The Notify url is a php script that accepts a ping back with the order details, you just check if payment was successful and email out the serial code.

I have some code in php for this stuff so let me know if you go down this path.