tags:

views:

137

answers:

1

Hi

I am trying to integrate Django-Paypal onto a site, where once the customer makes a payment I need to send a dynamic URL from which the user can download some specific information.

I am registering all users to a URL which allows them to buy the document. The URL which can only be accessed by a registered user with a verified email ids using django-registration, allows the user to connect to paypal and make payment.

How do I capture the signal and verify which user has made the payment for which product he/she is purchased, based on this information

1) I need to know two information, which user made the payment, and for which product did he or she make the payment?

2) Only if I have these information can I send the right UR:L by email.

Any help appreciated. I am not very sure how django-signals work. What all details does payment_was_successful signal return?

I am using IPN

+1  A: 

To capture the signal, you define your function, and connect it to the signal like this:

from paypal.standard.ipn.signals import payment_was_successful
def my_payment_was_successful_handler(sender, **kwargs):
    pass

payment_was_successful.connect(my_payment_was_successful_handler)

To be able to identify the user the IPN message is about, I usually modify the paypal button to pass a field named custom along in the form set to the django user.id or some other identifier you can look up to identify your user. The custom variable is sent back in the sender argument and you can find the user.

To find the product, the product_name is also sent in the sender to the handler listed above. You'll probably have a model for your products, and you'll want to look them up by this product_name to send the appropriate thing in email.

dar
Well, Thanks. This is exactly what I am trying to do.
ramdaz