Skip to content

Instantly share code, notes, and snippets.

@Infinity-James
Last active October 28, 2021 13:13
Show Gist options
  • Save Infinity-James/13d7152ad01ed008a1df242e054823a3 to your computer and use it in GitHub Desktop.
Save Infinity-James/13d7152ad01ed008a1df242e054823a3 to your computer and use it in GitHub Desktop.

Booking Flow

  1. The user taps on the type of ticket they wish to purchase.
  2. This action either displays a reservation confirmation panel or a required GDPR agreement that, if accepted, is followed by the panel.
  3. In this reservation confirmation view, the user can adjust the number of tickets to purchase (if the ticket type allows such adjustments), agree to non-required GDPR questions, and add a promo code.
  4. The user taps the call to action and: a) If the ticket is free, the user is immediately shown the details for the booking. Technically:
    i. I accept the relevant GDPR requirements via /api/v2/app/gdpr
    ii. I create a reservation via /api/v2/app/reservations
    iii. I check the created reservation pending or checked out, in which case I start polling for the booking details.
    iv. I poll for these details via /api/v2/app/reservations/{idempotencyKey} and receive:
    ///	Marks this reservation as unique.
    public let idempotencyKey: UUID
    ///	The identifier of the event for which this reservation has been made.
    public let eventIdentifier: Int
    ///	The state of the reservation.
    public let state: State
    ///	This is what will be used behind the scenes to complete the payment.
    public let paymentIntent: PaymentIntent?
    ///	The date this reservation will expire.
    public let expirationDate: Date?
    ///	Reports on each of the tickets within the reservation.
    public let ticketReports: [TicketReport]
    ///	The total price for these tickets.
    public let totalPrice: Double
    ///	An amount of credit which should be deducted from the total.
    public let userCreditDeduction: Double?
    ///	The currency of the price.
    public let currency: Currency
    
    v. From this object, I extract the booking identifier, and then fetch the booking via /api/v2/app/booking/\{identifier}

b) If payment is required, the user is taken to the payment screen in which they can edit their cards, select one, and pay with either a card or Apple Pay. On this screen, the user is shown an expiration timer. The user taps the call to action and they are shown a red screen with various stages. Upon a successful purchase, they are taken to the details for the booking.
i. I accept the relevant GDPR requirements via /api/v2/app/gdpr
ii. I create a reservation via /api/v2/app/reservations
iii. I wait for the user to select payment. Once card is selected, I complete the payment via Stripe.
iv. From here, the process is the same as in a free booking.

This flow ignores irrelevant nuances such as Apple Pay display, errors, missing user information, pre checkout additional questions, booking expiration, and others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment