Skip to content

Paypal and Stripe donations process

Andres Ferraro edited this page Jun 12, 2019 · 3 revisions

Paypal and Stripe donations process

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:

Stripe

  1. When the user submits the form a request is done using ajax to the url: 'donation-session-stripe'
  2. 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     |________|
  1. Then the user is redirected to Stripe with the given session id
  2. After the user completes the donation in Stripe is redirected to the url 'donation-success'
  3. After some time Stripe calls the url 'donation-complete-stripe' with the information of the donation

Paypal

  1. 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  |___________|
  1. The user is redirected to paypal
  2. The user completes the donation (and is not redirected to freesound)
  3. 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.