Testing renewals
Try a membership renewal, a failed renewal and its recovery in test mode, in minutes, with the next charge action and Stripe's test cards
A paid membership renews once a month or once a year, which is too slow to test by waiting. In test mode you can make each part of a renewal happen now, on a real test membership, with the same calls and the same activities your integration will see in live mode:
| You want to see | Do |
|---|---|
| A renewal | Charge the next period now |
| A failed renewal | Save a card that declines, then charge now |
| Recovery from it | Save a good card again |
Use a test organizer and a tk_test_… key, and join a paid plan with Stripe's
test card 4242 4242 4242 4242 (any future expiry, any CVC) first, so the
membership is active. Each step below takes one Idempotency-Key; use a new
one every time. The engine learns the outcome of a payment from Stripe's own
events, a few seconds later: read the membership with
GET/v1/memberships/{id} or follow the
activity stream rather than acting on the first answer
alone.
A renewal
Charge the next period now with next charge:
curl -X POST https://tickets.lissen.com/api/v1/memberships/$MEMBERSHIP_ID/next_charge \
-H 'Authorization: Bearer tk_test_…' \
-H 'Ticketing-Organizer: org_…' \
-H 'Idempotency-Key: 0f6c2a10-…' \
-H 'Content-Type: application/json' \
-d '{ "at": "now" }'{
"membership": { "status": "active", "next_charge_at": "…one period from now…", "...": "..." },
"charge_attempt": { "outcome": "paid", "decline_code": null }
}The plan's full price is charged now and a fresh period starts from now. You
get membership.renewed, and the payment appears as a membership charge
(GET/v1/memberships/{id}/charges) with its
platform fee and, if the organizer charges tax on memberships, its tax, just
as a monthly renewal would.
A failed renewal
- Open the member's payment-method update
and save Stripe's test card
4000 0000 0000 0341. It saves, but every charge on it is declined. - Charge now, as above, with a new
Idempotency-Key.
{
"membership": { "status": "past_due", "in_grace": true, "grace_ends_at": "…", "...": "..." },
"charge_attempt": { "outcome": "failed", "decline_code": "generic_decline" }
}This is exactly a failed monthly renewal: the membership is past_due, and if
the plan has a benefit grace period
(grace_days above 0) the member keeps the benefits until grace_ends_at.
membership.updated records the failure. Stripe now retries the payment on its
own schedule over the next days.
Recovery
Open the payment-method update again and save 4242 4242 4242 4242. Once
Stripe confirms the new card, the engine tries it once on the overdue invoice.
The invoice is paid, the membership is active again with
membership.renewed, and its grace is cleared. No second invoice is created.
To recover without changing the card, or to retry after a decline, call next
charge with "at": "now" on the past_due membership: it pays the overdue
invoice with the card on file and says how it went in charge_attempt.
Other things to try
- Move the next charge. Send a date instead of
nowto seenext_charge_atmove withmembership.updated. Nothing is charged until that date. - A card that needs authentication. Stripe's
4000 0027 6000 3184asks for 3-D Secure on every charge, which a renewal cannot do while the member is away:charge_attempt.outcomeisrequires_action, the membership ispast_due, and Stripe does not retry it. The member fixes it through the payment-method update.
Plans, states and effects
The membership reference — plan fields, the join contract, every state, the effects a member gets, and cancellation
Invitation allocations and pools
Give someone a limit of free tickets for an event, share a cap across several of them, and issue their guests' tickets with a comp that names the allocation.