Hi!
I made a fork off django-paypal some time ago. The two things that
concern
me are, or were, state transitions and tracking whence IPNs came from.
The stuff is up at
http://github.com/mjtorn/django-paypal/tree/track_view
http://github.com/mjtorn/django-paypal/tree/multistate
I'm not sure if this has been going anywhere, but IMO they should be
merged as they have received a lot of testing and are worth more
in the mainline than my fork.
State transitions are fairly easy, there were issues that when a
payment
was set in Pending, going to another state thought it to be a
duplicate
and caused an error.
View tracking is useful when we end up in the return view before the
IPN hits the notify view. We can then create an entry in the
bookkeeping
for the return and keep refreshing the page until we have the same IPN
from notify.
The following describes the "protocol" or "algorithm" for efficiently
using this:
The application-specific return url checks for an IPN that originated
from notify, and if one is found, redirects out. Meta refresh is good
for this.
Otherwise it tries to get one that originated from return-
If one is not found, there's a helper in views, handle_ipn_post, that
creates an ipn object for us, an ipn object we will .save().
If one is found, we ignore it and let meta refresh load the page
again,
to see if we have the IPN from notify, and if not, keep refreshing.
Maybe think the code explains it better than I :)
Thanks!