Before you start
- A sandbox API key (
sk_sandbox_...). See API keys and authentication. - Familiarity with selling a subscription: a trial is a recurring product with a trial window.
Steps
1
Add a trial to the product
A trial is a property of the product: a
trial_period duration alongside the recurring billing_cycle. Set it when you create the product.Create a product with a 14-day trial
trial_period is a duration: { "interval": "day", "frequency": 14 } is 14 days. It’s only meaningful on a recurring product (one with a billing_cycle); it does nothing on a one-time product.2
Start the trial (check the customer out)
There’s no separate trial call. When a customer completes a checkout for a product that has a When the trial ends, Bachs bills the first cycle off-session using the saved card, the subscription moves to
trial_period, Bachs saves their card without charging it, creates the subscription in trialing, and schedules the first charge for the end of the trial.Subscription created in trial
active, and normal renewals begin. If the customer cancels before the trial ends, they’re never charged.3
Extend or end a trial (optional)
Manage a trial on an existing subscription through a single field,
trial_end, on Update a subscription. A trial change stands alone; don’t combine it with other changes in the same request.- A future
trial_endextends (or starts) the trial and postpones billing. This works even on anactivesubscription, which becomestrialing. On anactivesubscription, the trial must end aftercurrent_period_end, the end of the period the customer has already paid for. The trial end starts a new billed period, so a trial ending sooner would charge them twice for the same days. Such a request returns400withSUBSCRIPTION_TRIAL_ENDS_IN_PAID_PERIOD. - A
trial_endof now or the past ends the trial immediately: the subscription becomesactive, a fresh billing cycle starts, and Bachs charges the first cycle right away.
What you’ll receive
- Trial started:
customer.subscription.createdwithstatus: "trialing". - Trial added, extended, or ended:
customer.subscription.updated. - Trial ends and the first cycle is billed:
invoice.paid, orinvoice.payment_failedif the saved card fails (which starts payment recovery).
Next steps
- Live demo: buy the 14-day trial on the demo storefront and watch the subscription start as
trialing. - Sell a subscription: the full recurring flow a trial sits on top of.
- The subscription object: the
trialingstatus andtrial_endfield. - Recover failed payments: what happens if the first charge fails.

