Jude Molloy
Jude Molloy

Reputation: 193

Django - Call function when someone pays through PayPal

I am trying to work out how to call a function or something that will add points to a user's account when they purchase something through PayPal. For example, if someone buys 1000 credits it will add 1000 credits to a database field for their account.

All help is appreciated, if anyone needs more information feel free to ask.

Upvotes: 0

Views: 42

Answers (1)

2ps
2ps

Reputation: 15926

When implementing PayPal express checkout, like @DanielRoseman said, You will provide PayPal two URLs. A return URL that PayPal will redirect the user to if the user successfully completes payment, and a cancel URL if the user selects cancel and return to website. As long as your webserver supports HTTPS and as long as you implement those two URLs in django, you should be good to go.

Alternatively, if you are doing a front-end integration, you will use PayPal’s v.zero which will return a nonce to your JavaScript that you will then have to pass back to your server to verify.

Upvotes: 1

Related Questions