Forum OpenACS Development: Pay Pal

Collapse
Posted by Jon Griffin on
I am doing a simple paypal selling on my site and wonder if anyone has written anything for Paypal IPN?

I don't need or even want to use the ecommerce module as it is much too complex, so I started hacking a mini paypal package.

I figure if someone else has dealt with IPN, it would save me the time, otherwise I will finish it up and package it for OACS.

Collapse
2: Re: Pay Pal (response to 1)
Posted by Chris Davies on
Haven't done it yet myself, but it is on my todo list -- managed by Project Manager.  :)

I've actually got to dig into this myself, both from an ecommerce standpoint and from a non-ecommerce standpoint.  If you can, I would appreciate it if you would package it.

Collapse
3: Re: Pay Pal (response to 1)
Posted by Cathy Sarisky on
I volunteer to test! :)  This would be really useful.
Collapse
4: Re: Pay Pal (response to 1)
Posted by Jonathan Ellis on
I'll email you the IPN code I use on carnage blender.  It's pretty simple stuff but at least it will save you some time finding out about IPN protocol corner cases the hard way.
Collapse
5: Re: Pay Pal (response to 1)
Posted by Mark Aufflick on
Wow - so many threads on paypal and no code to be found :) Even a totally useless post by me!

Ok, so I am now in a place where I really want to do paypal payments for my own hosting business, so I might actually get it done!

I'm thinking of a simple support package that will have utility methods to generate the right links/posts for buy now and shopping cart type interactions, as well as handle the IPN callback stuff and provide methods for querying IPN data (and maybe a tcl callback for when IPN data comes in - it could use the paypal custom value to key against an acs object_id).

So as I start, if anyone has any working IPN code that would be helpful, but it doesn't seem too hard.

Collapse
6: Re: Pay Pal (response to 1)
Posted by Mark Aufflick on
Correction, there is a useful snippet of code in the forums fron Jonathon Ellis:

https://openacs.org/forums/message-view?message_id=135567

Collapse
7: Re: Pay Pal (response to 1)
Posted by Patrick Giagnocavo on
There are a number of PHP packages that do PayPal - no doubt you can use that to derive all the logic and any "special sauce" needed.
Collapse
8: Re: Pay Pal (response to 1)
Posted by Andrew Grumet on
More sample code here:

https://openacs.org/forums/message-view?message_id=305818

Also, I looked at IPN enough to get working code, below:
set form [ns_conn form]

for {set i 0} {$i < [ns_set size $form]} {incr i} {
    set key [ns_set key $form $i]
    set value [ns_set value $form $i]
    ns_log Notice "ipn: $key=$value"
}

set qsset [ns_set copy [ns_conn form]]
ns_set put $qsset cmd "_notify-validate"
set results [ns_httppost http://www.sandbox.paypal.com/cgi-bin/webscr "" $qsset]

ns_set free $qsset

ns_log Notice "ipn: results=$results"

ns_return 200 text/plain done
Collapse
9: Re: Pay Pal (response to 1)
Posted by Mark Aufflick on
Great - thanks Andrew. I'll put more time on this tonight.
Collapse
10: Re: Pay Pal (response to 1)
Posted by Mark Aufflick on
Just a cross post for your convenience if you're watching this thread - I have posted my first attempt at a paypal package:

https://openacs.org/forums/message-view?message_id=312831