Checkout
A checkout charges one-time items and starts one or more subscriptions in a single payment. Your customer enters a card once, confirms once, and sees one charge. Use it when a plan comes with something else on the first invoice, such as a setup fee, a hardware kit, or a second plan.
When to use a checkout
| You want to… | Use |
|---|---|
| Charge for one-time items only | createPayment |
| Start one subscription with nothing else on the first charge | createSubscription |
| Charge one-time items and start one or more subscriptions together | createCheckout |
A checkout with no subscriptions behaves like a payment, and one with a single subscription and no one-time items behaves like createSubscription. Each subscription still renews on its own schedule afterward.
Prerequisites
- Your project owner has completed compliance registration (live projects must be
APPROVED). Sandbox projects bypass this.
Limits
- At most 10 subscriptions per checkout.
- At most 50 line items across the whole checkout, one-time and subscription lines together.
- At least one one-time line or one subscription.
- Card only. A checkout that includes a subscription can't be paid with ACH direct debit, for the same reasons given in Subscriptions.
- The subtotal due today, when anything is due today, and each subscription's subtotal must be at least the smallest charge Forte accepts, because each subscription renews as its own charge.
lineItemIdandsubscriptionIdon the lines you send are ignored. Forte sets them.
Creating a checkout
Call createCheckout with a currency, any one-time lineItems, and a list of subscriptions. Each subscription has its own interval, lineItems, and optional description, metadata, startTime, and endTime. Use the client-side surface when a signed-in user checks out. Use the server-side surface from your backend with an API key. See API Surfaces.
Client-side (signed-in user session):
POST /api/v1/{projectId}/users/me/checkoutsPOST /api/v1/{projectId}/users/me/checkouts/preview
Server-side (API key):
POST /api/v1/projects/{projectId}/users/{userId}/checkoutsPOST /api/v1/projects/{projectId}/users/{userId}/checkouts/preview
import { ForteClient } from "@forteplatforms/sdk";
const forte = new ForteClient();
const result = await forte.users.createCheckout({
projectId,
createCheckoutRequest: {
currency: "usd",
description: "Pro plan with onboarding",
lineItems: [
{ description: "Onboarding", unitAmountCents: 9900, quantity: 1, taxCode: "txcd_20030000" },
{ description: "Starter kit", unitAmountCents: 2500, quantity: 1, taxCode: "txcd_99999999" },
],
subscriptions: [
{
interval: "MONTH",
description: "Pro plan",
lineItems: [
{ description: "Pro plan", unitAmountCents: 4900, quantity: 1, taxCode: "txcd_10000000" },
],
},
],
customerAddress: { line1: "...", city: "...", state: "...", postalCode: "...", country: "US" },
shippingAddress: { line1: "...", city: "...", state: "...", postalCode: "...", country: "US" },
// paymentMethodId is optional: omit it to let the customer enter a card now (it's saved for renewals).
},
});
const { payment, subscriptions, stripeClientSecret, stripePublishableKey, stripeConnectedAccountId } = result;The response contains:
payment: the singlePaymentfor the first charge. Each line on it has alineItemId, which you use to refund an item. It'snullwhen nothing is due today.subscriptions: one subscription per entry in your request, in the same order. Each isINCOMPLETEuntil the payment is confirmed, and a future-dated subscription staysINCOMPLETEuntil its first charge. The list is empty when you sent no subscriptions.stripeClientSecret,stripePublishableKey, andstripeConnectedAccountId, as withcreatePayment.
metadata on the checkout is stored on the Payment. Each subscription keeps its own metadata.
Previewing the first charge and each renewal
createCheckoutPreview takes the same body as createCheckout, minus paymentMethodId. The call is read-only: nothing is charged or saved.
It returns:
- The first charge:
subtotalCents,taxCents,amountCents, andlineItems(one-time lines first, then each subscription's lines in request order).taxCentsisnullwhen you send no address. Future-dated subscriptions aren't included, so these are0when nothing is due today. - Each renewal: a
subscriptionslist, in request order, where each entry hasinterval,subtotalCents,taxCents,amountCents,lineItems,startTime, andnextRenewalAt. For a future-dated subscription,startTimeis when these amounts are first charged andnextRenewalAtis the renewal after that.
Use it to show "Due today: $X. Then $49.00 per month starting …" before the customer commits. Renewal figures are estimates, because each real renewal recalculates tax.
Confirming with one client secret
Confirm stripeClientSecret with Stripe Elements exactly as you do for a one-off payment (Confirming the payment in the browser). That one confirmation pays for every line and saves the card for renewals. When it succeeds, every subscription on the checkout becomes ACTIVE.
If you omit paymentMethodId, the card the customer enters is saved. If you pass a saved card, Forte uses it for this charge and for renewals. The customer may be asked for an extra card authentication step (3D Secure) during confirmation. Elements handles the prompt.
If a saved card can't be reused for renewals, each subscription is cancelled, and the one-time items stay paid.
Starting a subscription later
Pass startTime on a subscription to start it on a future date. Your customer enters a card once, but sees two charges: today's charge for everything else, then a separate charge on startTime for that subscription. Tell them so before they pay.
subscriptions: [
{
interval: "MONTH",
startTime: new Date("2027-01-01T00:00:00Z"),
lineItems: [{ description: "Pro plan", unitAmountCents: 4900, quantity: 1, taxCode: "txcd_10000000" }],
},
],startTimemust be in the future, andendTimemust be after it. Otherwise the call returns a400.- In the SDK, pass
startTimeandendTimeasDateobjects; a string fails. In a raw HTTP request, send ISO 8601 strings. - Today's charge saves the card for the later one. The first charge on
startTimeruns without the customer present, and each later renewal follows from that date. - The subscription stays
INCOMPLETEuntil its first charge succeeds. If that charge is declined, it follows the usualPAST_DUEand retry path. - If the customer never confirms today's charge, the future-dated subscription is cancelled and never charged.
PAYMENT_COMPLETEDfor today's charge doesn't list future-dated subscriptions insubscriptionIds. Each one fires its ownPAYMENT_COMPLETEDwhen its first charge succeeds. Grant access then, not when the checkout is paid.
When nothing is due today
If every subscription is future-dated and there are no one-time items, there's nothing to charge today and payment is null:
- With a saved card (
paymentMethodId):stripeClientSecretisnull. Nothing needs confirming, and the subscriptions are already scheduled. - With a new card: confirm
stripeClientSecretwithstripe.confirmSetup, notconfirmPayment. The subscriptions are scheduled once the card is saved. If the customer doesn't confirm within 24 hours, they're cancelled.
Offering a free trial
There's no separate trial setting. Set startTime to the day the trial ends, and the customer pays nothing until then. If the checkout has nothing else in it, nothing is due today.
subscriptions: [
{
interval: "MONTH",
startTime: new Date(Date.now() + 14 * 24 * 60 * 60 * 1000), // 14-day trial
lineItems: [{ description: "Pro plan", unitAmountCents: 4900, quantity: 1, taxCode: "txcd_10000000" }],
},
],- Start the trial yourself. No trigger fires when a trial starts, and the subscription stays
INCOMPLETEthroughout, so don't gate access onACTIVEorPAYMENT_COMPLETED. Grant access once the card is saved: whencreateCheckoutreturns (saved card) orconfirmSetupsucceeds (new card).nextRenewalAton the subscription is set from that point. - When the trial ends, Forte charges the saved card.
PAYMENT_COMPLETEDmeans the customer is now paying.SUBSCRIPTION_STATUS_CHANGEDwithPAST_DUEmeans the charge was declined. - To cancel during the trial, see below. The customer isn't charged.
Cancelling before the start date
Nothing has been charged yet, so there's nothing to refund. DELETE .../subscriptions/{id} cancels immediately. PATCH .../subscriptions/{id} with { cancelAtPeriodEnd: true } cancels on startTime instead of charging.
What renews
Each subscription renews on its own, on its own interval, and only its own lines are charged. One-time items never renew. Renewals, failed-payment retries, and cancellations work as described in Subscriptions.
A subscription's price is set from its own lines, not from the checkout total. For example, a checkout of a $99 setup fee and a $49 monthly plan starts a subscription that renews at $49 plus tax.
Tax addresses
- Subscription lines are always taxed at
customerAddress, on the first charge and on every renewal. - One-time lines are taxed at
shippingAddresswhen you send one, and atcustomerAddressotherwise. shippingAddressrequirescustomerAddress. Sending only ashippingAddressreturns a400.- With no
customerAddress, no tax is computed, as withcreatePayment.
Triggers
A checkout fires one PAYMENT_COMPLETED trigger, not one per item. The body includes subscriptionIds, an array with the ID of every subscription the payment started.
{
"event": "PAYMENT_COMPLETED",
"userId": "usr_...",
"paymentId": "pay_...",
"subscriptionIds": ["sub_...", "sub_..."],
"paymentTime": "2026-11-02T18:42:11.123Z",
"state": "COMPLETED"
}subscriptionId is also sent when the payment started exactly one subscription. For a checkout with no subscriptions, the trigger omits subscriptionIds. Read subscriptionIds in new handlers. Each subscription's later renewals fire their own PAYMENT_COMPLETED with that subscription's subscriptionId.
Refunding one item
A checkout has no refund route of its own. It creates a normal Payment, so you refund it with refundPayment. Pass lineItems in the request body to refund individual lines, using the lineItemId values on the payment.
For each line, amountCents is the pre-tax amount to refund. Omit it to refund the rest of that line. Forte works out the tax share and returns it with the refund. Refunding the last of a line returns exactly the tax that remains, so the totals always match what you charged.
// Refund the whole "Onboarding" line, tax included.
const payment = await forte.projects.refundPayment({
projectId,
userId,
paymentId,
createPaymentRefundRequest: {
lineItems: [{ lineItemId: "li_..." }],
},
});
// Refund $20.00 (before tax) of the "Starter kit" line.
const partial = await forte.projects.refundPayment({
projectId,
userId,
paymentId,
createPaymentRefundRequest: {
lineItems: [{ lineItemId: "li_...", amountCents: 2000 }],
},
});Rules for line refunds:
- Don't combine
lineItemswithrefundAmountCents. That returns a400. - A
lineItemIdthat isn't on the payment returns a400. Payments created before line refunds existed have no line IDs, so refund those by amount. - An
amountCentslarger than what's left on a line returnsINVALID_REFUND_AMOUNT.
Cancellation rules
A refund can cancel the subscriptions on a checkout. What happens depends on how you refund.
| Refund | Default effect | With keepSubscriptionActive=true |
|---|---|---|
| Lines through the API | Cancels only the subscriptions whose lines you refund | Cancels none |
| Amount only through the API | Cancels all subscriptions on the payment | Cancels none |
| Partial refund from the Stripe dashboard | Cancels none | Not applicable |
| Full refund from the Stripe dashboard, or a lost dispute | Cancels all | Not applicable |
keepSubscriptionActive applies to every refund you make through the API, including a full refund. Refunds made in the Stripe dashboard and disputes don't go through it, so the last two rows are fixed.
Refunding a one-time line leaves the subscriptions running. Refunding a subscription's line cancels that subscription and no others.
A future-dated subscription has no lines on today's charge, so refunding lines never cancels it. The rows that cancel all subscriptions include future-dated ones.
The Forte console refund dialog also lets you pick lines and amounts, and shows the tax and total before you confirm.