-
Step 1 of 7Checkout
Pick a plan
Plans are course bundles: a list of courses, a type and a number of days of access. Buying one stores the order in the session and opens a payment page with every gateway that's switched on.
-
Step 2 of 7Edge case
Reuse the bKash token
bKash needs an id_token on every call. It's cached in its own table: a valid one is reused, an expired one is refreshed, and only when none exists does the site ask bKash for a new grant.
-
Step 3 of 7bKash
Create the payment, hand over
The site creates a tokenized checkout payment in BDT with a callback URL, then sends the student to bKash's own page to approve it in their wallet.
-
Step 4 of 7bKash
Execute on the callback
bKash returns the student to the callback, and the server executes the payment by its ID. Status 0000 means paid: the site records the bundle payment and revenue, emails a receipt and opens My subscriptions.
-
Step 5 of 7Access
Access that expires on time
One helper inserts or renews the enrolment with the bundle's courses and an expiry date. Every course page asks the same access check: valid until that date, expired after it.
-
Step 6 of 7Manual
Nagad and bank transfer
Nagad and bank transfers are manual: the student submits the transaction ID and a proof upload, and it waits as pending. When an admin approves it, the same enrolment helper grants access, optionally with a custom length.
-
Step 7 of 7Recap
One path to access
Whatever the payment method, access is granted by one helper and checked by one function. I co-developed this subscription billing with bKash, Nagad and bank transfer.
Tip: the ← and → keys work too.