trial-codes
Redeem With Cancel
Redeem a trial code for an existing paying customer.
TECH-657: Cancels the Stripe subscription (triggers prorated credit), then applies the trial with the target plan.
Transaction Safety (order prevents data loss):
- Validate code
- Record redemption (marks code as used)
- Update subscription to trial with target plan
- Clear Stripe IDs in DB
- COMMIT DB FIRST (ensures trial is active before touching Stripe)
- Cancel Stripe subscription (external call, may fail)
Why commit before Stripe cancel:
- If DB commit fails: Customer keeps Stripe subscription (safe rollback)
- If Stripe cancel fails after commit: Customer has trial + Stripe sub (recoverable via manual cancellation, customer is not left without access)
- Previous approach risk: If Stripe succeeds but commit fails, customer loses Stripe sub AND doesn't get trial (unrecoverable data loss)
post/api/v1/billing/trial-codes/redeem-with-cancel
Request
- Base URL: http://localhost:8000
- URL: http://localhost:8000/api/v1/billing/trial-codes/redeem-with-cancel
- Auth: none declared
Headers
Authorizationstring
Request body
Response
Successful Response
Changes
No recorded changes to this operation across all 1 revision of this API.