-
Notifications
You must be signed in to change notification settings - Fork 1
Payment Flow
Example: T-5Y2K6BC6H
Ticket ID is generated via Nano ID.
Custom alphabet is used to remove similar symbols and only use capitals.
0123456789ABCDEFGHJKLMNPQRSTUVWXY
.
Symbols removed are I
, O
and Z
due to their similarity to 1, 0 and 2. Taken from Nintendo Store redeem codes.
ID length is 9 characters long which is an arbitrary value chosen as it is short to type but long enough to have a low chance of a collision as we are generating these blind. The Nano ID collision checker states that with the custom alphabet and character length that when generating 1000 IDs per second, it would take around 40 days to have a 1% collision chance. As we are a smaller scale event, even generating just 1 per second would take 110 years to have a 1% collision chance.
T-
is then added as a prefix to the ID to provide more human readability that this is a ticket ID.
Ticket IDs are generated whenever a new ticket entry has been added. This is done via the resolveInput
hook on the ticket schema. These are generated blind meaning that we do not check the database if it exists before adding it. The ticketID
property is set to be unique so the database will error out if this occurs. Due to the low chance of this occuring I believe this is a non issue.
A UML sequence diagram is probably better but ¯\_(ツ)_/¯
- User sets number of tickets to purchase and presses the purchase button.
- New ticket entry added with the user ID and number of tickets to purchase and purchase method of "bank".
- Data returned from mutation query is the ticketID, total cost and the number of tickets.
- User is presented with the ticket ID and information on the BSB and Account number to send the total cost to as well with the reference ID. The reference ID being the ticket ID.
- Once a week the event coordinator will look through the bank transactions and search the reference IDs in the database and manually mark them as paid.
- The website will now say that the ticket has been paid and a barcode will be shown.
- User presses the purchase button.
- User is redirected to
/api/checkout_ticket?account=XXXXXXXX
.-
account
contains the user Keystone ID.
-
- Stripe checkout session is created.
- New ticket entry added with the user ID (from
account
url query) and Stripe session ID populated. - User is redirected to Stripe checkout URL.
- User can adjust the amount of tickets they want to purchase in Stripe checkout.
- A webhook call is received from Stripe through
/api/webhooks
with the eventcheckout.session.completed
. - A request to Stripe is made to get the amount of tickets bought.
- The ticket entry is then modified to have the correct number of tickets and to set the ticket as paid.
- The user is redirected back to the tickets page with the URL parameters
cancelled=true
andsession_id={STRIPE_SESSION_ID}
. - The ticket page deletes the ticket if both URL parameters are found.