-
Notifications
You must be signed in to change notification settings - Fork 87
Paypal and Stripe donations process
Andres Ferraro edited this page Jun 12, 2019
·
3 revisions
The process when a user makes a donation is similar for Stripe and Paypal. We have a single form with two buttons for Paypal and Stripe donations. These are the steps followed on each case:
- When the user submits the form a request is done using ajax to the url: 'donation-session-stripe'
- The Freesound server sends the information to Stripe and creates a session. Stripe returns the id of the session which is returned to the client.
Stripe Donation:
___________ Donation form ___________ donation data ________
| Freesound | ---------------> | Freesound | ------------------> | |
| front-end | <--------------- | back-end | <------------------ | Stripe |
|___________| session id |___________| session id |________|
- Then the user is redirected to Stripe with the given session id
- After the user completes the donation in Stripe is redirected to the url 'donation-success'
- After some time Stripe calls the url 'donation-complete-stripe' with the information of the donation
- When the user submits the form a request is done using ajax to the url: 'donation-session-paypal' and the server returns the information required to make the redirect to paypal:
Paypal Donation:
___________ Donation form ___________
| Freesound | ---------------------> | Freesound |
| front-end | <--------------------- | back-end |
|___________| encoded information |___________|
- The user is redirected to paypal
- The user completes the donation (and is not redirected to freesound)
- After some time Paypal calls the url 'donation-complete-paypal' with the information of the donation
In both cases note that some information is sent to the payment method encoded using base64, including: user id, campaign, if it's anonymous, etc. This is information is sent from the payment method to freesound endpoint when the donation is complete. This is used to display to create the donation object in the DB.