Amplify uses Stripe to process donations for non-profit organizations. Amplify uses these API endpoints to store and complete transactions.
A step by step guide for how to interact with Stripe API in Amplify.
Retrieves session from Stripe to insert into database.
- Send session ID to API endpoint.
- Retrieve Stripe session with that session ID.
- Format session data to be inserted into database.
- Insert into database.
Create Stripe session.
- Send donation amount to API.
- Format and validate donation amount.
- Create Stripe session with the following parameters:
- line_items: donation amount
- allow_promotion_code: true
- success_url: redirects to /complete?session_id={CHECKOUT_SESSION_ID}
- cancel_url: redirects to origin
- Send back session.url and session.id
- Send request to
/create-payment-intent
with adonationAmount
as string or integer. If user doesn’t select any particulardonationAmount
, send1
in thedonationAmount
- This API will redirect the client to a Stripe Checkout page
- Once user completes payment, it will redirect back to
success_url
with a Stripe session_id included in the URL.