Skip to content

Commit 61487b0

Browse files
committed
added basic stripe payment flow
1 parent 01c6ff3 commit 61487b0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

knowledge_base/_payments.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ The WCA website primarily uses Stripe for its payment processing, but WST is in
2828

2929
## Stripe Implementation
3030

31+
This is a very broad overview of how Stripe payments are initiated from the frontend - it is not an exhaustive explanation of our payments sytem.
32+
33+
- A Stripe `Element` component is imported from Stripe's React SDK - this is a context which stores the following data
34+
- `stripe` which is essentially the authenticated API interface
35+
- information relating to the amount to be charged (amount and currency) - this will be validated against the payment intent
36+
- This payment information is populated by an amount returned from the `payment_denomination` endpoint - which takes an amount and currency, and returns a Stripe-API compatible amount/currency code
37+
- When the user clicks "Pay now", the following actions take place
38+
- `payment_ticket` on our backend is called, with parameters which include the donation amount
39+
- `payment_ticket` adds the given donation amount to the currency code and base registration fee (queried from the `competition` object in our database - ie, not passed by the frontend) and creates a `payment_intent` object in our code
40+
- Upon being created, our `payment_intent` creates a `PaymentIntent` on Stripe's server
41+
- Stripe returns a `clientSecret` upon the creation of a payment intent in its server
42+
- This clientSecret will allow our frontend to securely reference the payment intent via Stripe's React SDK
43+
- `payment_ticket` returns the `clientSecret` to the frontend
44+
- Upon receiving the `clientSecret` from the `payment_ticket` endpoint, the frontend initiates the payment using Stripe's React SDK
45+
- We will receive a notification (via webhook or, more likely, the return_url) of the payment's status once it reaches a terminal state (failure, success, etc)
46+
3147
## Paypal Implementation
3248

3349
_Paypal is currently in a proof-of-concept phase in its implementation - the following reflects expedient design rather than good design, and there is room for improvement._

0 commit comments

Comments
 (0)