Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Purchasing a Plan

This flow describes how customers browse plans, create orders, pay, and receive service.

What customers can do

  • View plans available to their account tier
  • Apply valid coupons before checkout
  • Pay by supported gateway methods or account wallet
  • Cancel unpaid orders
  • Track order status until service delivery

End-to-end purchase flow

flowchart TD
    browse[BrowsePlans] --> coupon[OptionalApplyCoupon]
    coupon --> create[CreateOrder]
    create --> payMethod{ChoosePaymentMethod}
    payMethod -->|Gateway| gatewayPay[ExternalGatewayPayment]
    payMethod -->|Wallet| walletPay[WalletPayment]
    gatewayPay --> paid[OrderMarkedPaid]
    walletPay --> paid
    paid --> delivery[PackageDelivery]
    delivery --> active[ServiceBecomesActive]

Plan visibility

Customers only see plans that match their current eligibility (group access and sale status).
This allows the same platform to run multiple customer segments.

Coupon usage

  • Coupon is checked when user previews it.
  • Coupon is checked again at order creation.
  • Final payable amount is locked at order creation.

If a coupon becomes invalid before order creation completes, checkout should fail with a clear message.

Payment paths

Gateway payment

  • Customer is redirected to a payment page.
  • System confirms callback from provider.
  • Order becomes paid after verification.

Wallet payment

  • Uses available wallet balance only.
  • Payment and order update happen atomically.
  • Best UX for repeat customers with balance.

Order lifecycle

  • Unpaid: waiting for payment
  • Paid: payment confirmed, waiting for service delivery
  • Delivered: service package assigned
  • Cancelled: unpaid order cancelled by user, admin, or timeout

Operational notes

  • Unpaid orders are auto-cancelled after configured timeout.
  • There is a limit on how many unpaid orders one user can hold.
  • After successful payment, frontend should poll order status until delivered.

What customers cannot do

  • Use coupons outside validity rules (time window, limits, minimum amount)
  • Pay with wallet if available balance is insufficient
  • Recover a cancelled order (must create a new order)
  • Force immediate delivery if backend delivery queue is delayed