Forum OpenACS Development: Re: First stab at a PayPal package

Collapse
Posted by Mark Aufflick on
That's the first and easy part.

The second (and not hard, but not quite so easy part) is handling Paypal's IPN (Instant Payment Notification) interface which allows you to verify that a payment actually happened.

My IPN in a nutshell (1st paragraph of original post) isn't that informative, but the beauty of having it abstracted in this sort of way is that you won't need to know anything about it.

Your package would do the following:

1) Implement a tcl callback(s) that you want to run when Paypal has correctly notified you of a payment
2) Use the tcl API to generate the Buy Now link(s) (one of the arguments that you pass to the api is later used to determine which tcl callback to call)

When Paypal sends it's notification, the package will verify it, and then call your requested callback with an ns_set providing all the data from Paypal (total amount, shipping, tax, invoice number etc.)

Two examples of what you might do with it are:

when you get actual notification of the payment,
a) send a request to your warehouse to ship the product
b) have the tcl callback set their user account to verified if you are running a subscription website

Note that IPNs come straight away for a buy now purchase - I believe that if you are using something like subscriptions etc., you will get an IPN every time a payment is made to your account.