Checkout and Payment Flow — Central Membership & SSO Hub
1. Document Purpose
This document explains the complete flow from member registration to active license, including the free activation process and paid checkout process.
2. Actors
- Member
- System
- Payment Gateway (Midtrans / Xendit)
3. New Member Registration Flow
- The member opens the Membership Hub registration page.
- The member fills in:
- full name,
- email,
- password,
- password confirmation.
- The system validates:
- email format,
- email uniqueness (lowercase, trimmed),
- password strength.
- The system creates an account with a status of
unverified. - The system sends a verification email.
- The member opens the email and clicks the verification link.
- The system changes the account status to
active. - The member is redirected to the dashboard.
4. Product Selection and Activation Flow
4.1 Viewing Product Catalog
- The member opens the product catalog page.
- The system displays a list of available SaaS products.
- The member selects a product (e.g., NOTO).
- The system displays a list of product packages.
4.2 Activating a Free Package
- The member selects the Free package.
- The system validates:
- active member account,
- no active license for the same product.
- The system creates a new license with:
- status:
active_free, - tier:
free, - expired_at:
null(no expiration).
- status:
- The system generates a License-ID with the format:
Example:[PREFIX_PRODUK]-[XXXX]-[XXXX]-[XXXX]NTO-A1B2-C3D4-E5F6 - The system displays the License-ID on the dashboard.
- The system sends a confirmation email containing the License-ID.
- The member can immediately access the product through SSO.
4.3 Paid Package Checkout
- The member selects a paid package (e.g., Pro Monthly).
- The system displays an order summary:
- product name,
- package name,
- price,
- duration,
- and payment gateway options (Midtrans / Xendit).
- The member selects a payment gateway.
- The system creates an order with a status of
pending_payment. - The system contacts the payment gateway to create a payment session.
- The member is redirected to the payment gateway's payment page.
- The member completes the payment.
5. Payment Flow
5.1 Successful Payment
- The payment gateway sends a webhook to the System.
- The System verifies the webhook (signature and amount).
- The System changes the order status to
paid. - The System creates or updates a license:
- status:
active, - tier: matching the purchased package,
- started_at: payment time,
- expired_at: started_at + package duration.
- status:
- The System generates a License-ID if not already generated.
- The System records the payment transaction.
- The System sends an email containing:
- payment confirmation,
- invoice,
- License-ID,
- and a link to access the product.
- The license is displayed on the member's dashboard.
5.2 Failed or Expired Payment
- The payment gateway sends a webhook failure or no response within the time limit.
- The System changes the order status to
failedorexpired. - The license is not activated.
- The System sends a notification to the member.
- The member can attempt checkout again.
6. Subscription Renewal Flow
6.1 Renewal Before Expiration
- The member opens the license details on the dashboard.
- The member selects Renew.
- The flow follows the Paid Package Checkout process (Section 4.3).
- After successful payment,
expired_atis updated:
(or from the payment date if already past due).expired_at_baru = expired_at_lama + durasi_paket
6.2 Renewal During Grace Period
- The license is in the
grace_periodstatus. - The member receives an urgent notification on the dashboard and email.
- The member can renew by following the checkout process.
- After successful payment, the license is reactivated.
7. Grace Period and Suspension Flow
Active License
│
▼ (expired_at reached)
Grace Period starts
│── Urgent email notification H+0
│── Urgent email notification H+3
│── Urgent email notification H+6
│
▼ (Grace Period ends, no renewal)
License suspended (Suspended)
│── Suspend email notification
│── Product access blocked
│── Data remains safe
│
▼ (if member pays after suspend)
License reactivated
The Grace Period duration is determined by system configuration (default: 7 days).
8. Duplicate License Rule
- A member can only have one active license per product at a time.
- If a member already has an active license for a product, a new purchase will extend the existing license.
- A member cannot have two active licenses for the same product simultaneously.
9. Idempotency Payment
- Each order has a unique
order_id. - Webhooks from the same payment gateway should not trigger license activation more than once.
- The System checks the order status before processing the webhook.
10. Acceptance Criteria
- The member can activate a free package without payment.
- A License-ID is generated and displayed after activation.
- A confirmation email is sent after activation.
- Successful payment automatically activates the license.
- Failed or expired payment does not activate the license.
- The Grace Period runs according to configuration.
- The license is suspended after the Grace Period ends.
- Renewal updates the active period correctly.
- There are no duplicate active licenses for the same product.