Creating subscriptions

Forte's Subscriptions API charges your end-users on a monthly or yearly schedule. You define the price with the same inline line items as a one-off Payment. Forte saves the card on the first charge, charges it off-session each cycle, and retries failures during a grace period. Every renewal creates a Forte Payment, so your payment reports and PAYMENT_COMPLETED triggers also cover subscriptions.

Subscriptions are available to every account. Compliance and live vs. sandbox work exactly like Payments.

Need to charge one-time items, such as a setup fee, together with a plan? Use a checkout to take one payment for both. It can start several subscriptions at once.

Prerequisites

  • Your project owner has completed compliance registration (live projects must be APPROVED, same as Payments). Sandbox projects bypass this.
  • The Subscriptions feature is enabled on your account (see the preceding callout).

How a subscription bills

PhaseWhat happens
First chargeConfirmed on-session in the browser with Stripe Elements (exactly like a one-off payment), which also saves the card. The subscription becomes ACTIVE once it succeeds.
RenewalsForte charges the saved card off-session at each interval. No user interaction; you don't call anything.
A renewal failsThe subscription goes PAST_DUE and Forte retries on a grace schedule. The user can fix their card to recover.
Grace exhausted / cancelled / reaches endTimeThe subscription becomes CANCELLED and stops billing.

The state is one of INCOMPLETE (first charge not yet confirmed), ACTIVE, PAST_DUE, or CANCELLED.

Subscriptions are card-only

Recurring subscriptions require a card. ACH direct debit can take a few business days to settle, so it doesn't support the fixed renewal and grace schedule. Use ACH for one-off Payments.

Only monthly and yearly cadences are supported

interval is MONTH or YEAR. No "every N weeks/days" option exists: Forte charges a subscription once per interval. Need weekly, daily, or custom cadences? Contact the Forte team.

Creating a subscription

Call createSubscription with line items, a currency, and an interval. Use the client-side surface when a signed-in user subscribes. 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/subscriptions
  • POST /api/v1/{projectId}/users/me/subscriptions/preview
  • POST /api/v1/{projectId}/users/me/subscriptions/{subscriptionId}/preview

Server-side (API key): create and manage a specific user's subscriptions:

  • POST /api/v1/projects/{projectId}/users/{userId}/subscriptions
  • POST /api/v1/projects/{projectId}/users/{userId}/subscriptions/preview
  • POST /api/v1/projects/{projectId}/users/{userId}/subscriptions/{subscriptionId}/preview
  • GET/PATCH/DELETE /api/v1/projects/{projectId}/users/{userId}/subscriptions/{subscriptionId}
  • PUT /api/v1/projects/{projectId}/users/{userId}/subscriptions/{subscriptionId}/items
typescript
import { ForteClient } from "@forteplatforms/sdk";
 
const forte = new ForteClient();
 
const result = await forte.users.createSubscription({
  projectId,
  createSubscriptionRequest: {
    currency: "usd",
    interval: "MONTH",
    description: "Pro plan",
    lineItems: [
      { description: "Pro plan", unitAmountCents: 4900, quantity: 1, taxCode: "txcd_10000000" },
    ],
    customerAddress: { 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 { subscription, stripeClientSecret, stripePublishableKey, stripeConnectedAccountId } = result;
// Confirm `stripeClientSecret` with Stripe Elements (see below) to activate the subscription.

The response mirrors createPayment: a subscription plus stripeClientSecret, stripePublishableKey, and stripeConnectedAccountId. Confirm the client secret with Stripe Elements exactly as you do for a one-off payment (Confirming the payment in the browser): that single confirmation both charges the first period and saves the card for renewals. The subscription is INCOMPLETE until the confirmation succeeds, then flips to ACTIVE automatically.

Saving the card is automatic

If you omit paymentMethodId, the first charge sets setup_future_usage=off_session, so the card the customer enters in Elements is saved and used for renewals: no separate "save a card" step. If you pass a paymentMethodId (a card the user already saved), Forte uses that card instead.

3D Secure on the first charge

The first charge of a subscription may prompt the customer for an extra bank verification step (3D Secure): Elements handles the prompt for you during confirmation. Once the customer authorizes it, renewals are charged automatically without prompting again.

Previewing the recurring total

createSubscriptionPreview is read-only: it returns subtotalCents, taxCents, amountCents, and the estimated nextRenewalAt, with no charge and nothing persisted. Use it to show "$49.00/month, renews on …" before the customer commits.

Scheduling a future start

Pass startTime (an ISO-8601 timestamp) to begin billing later. Because no one is present at that future moment to confirm a charge, a future startTime requires a saved paymentMethodId (SUBSCRIPTION_PAYMENT_METHOD_REQUIRED otherwise). The create call returns no client secret; Forte makes the first charge off-session at startTime.

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. No trigger fires when the trial starts and the subscription stays INCOMPLETE until the first charge, so grant trial access when the create call returns, not on ACTIVE or PAYMENT_COMPLETED.

To collect a new card for the trial, use checkout, which saves the card without charging it.

Ending automatically

Pass endTime to stop the subscription. The last charge is the last cadence point on or before endTime; after the current paid period runs out, the subscription becomes CANCELLED. Omit endTime to bill indefinitely until you cancel.

Renewals, failures, and the grace period

You don't call anything for renewals: Forte charges the saved card off-session at each interval and records a new Payment.

When a renewal fails (expired card, insufficient funds, and so on) the subscription goes PAST_DUE and Forte retries on a configurable grace schedule (by default a few attempts over a few days). To recover, the customer (or your backend) updates the card with a PATCH: Forte then retries immediately on the new card. If every retry in the grace window fails, the subscription is CANCELLED.

Expired or failing cards

A subscription exposes the card on file (cardBrand, cardLast4, cardExpMonth, cardExpYear) and a paymentMethodExpiresBeforeNextRenewal flag so you can prompt the user to update their card before it fails. After it fails, the SUBSCRIPTION_STATUS_CHANGED → PAST_DUE trigger is your signal to ask them to fix it.

Managing a subscription

ActionHow
Change the renewal cardPATCH .../subscriptions/{id} with { paymentMethodId }. The new method is re-validated as belonging to that user; if the subscription is PAST_DUE, the new card is charged immediately to recover it.
Change the billing address (tax)PATCH .../subscriptions/{id} with { customerAddress }. Recomputes tax and takes effect at the next renewal: no charge is made now. Quote the new total first with POST .../subscriptions/{id}/preview (see below).
Change the pricePUT .../subscriptions/{id}/items with the full new lineItems list. The change is staged and takes effect at the next charge, which is the next renewal or a future-dated subscription's first charge: the current paid period is unchanged. While a charge is due or in progress this returns a 400, so retry shortly.
Cancel at period endPATCH .../subscriptions/{id} with { cancelAtPeriodEnd: true }. Keeps access through the paid period, then stops. Before a future startTime, it cancels on that date without charging.
Cancel nowDELETE .../subscriptions/{id}. Stops future renewals immediately; the current period is not refunded.

Acting on a CANCELLED subscription returns a 400. You can also view and manage a user's subscriptions from the Forte console on the user's page.

Refunding a subscription charge cancels the subscription

If you refund a subscription's payment through the Forte API or console, the subscription is cancelled by default, even for a partial refund. Pass keepSubscriptionActive=true on the refund to refund a single period and keep billing. This applies to full refunds too. A partial refund made in the Stripe dashboard does not cancel the subscription, while a full refund there, or a lost dispute, does. To refund one line of a payment that covers several items, see Checkout.

Changing the billing address used for tax

A subscription stores the customerAddress you created it with, and Forte recalculates tax from that address on every renewal. When a customer moves: or the address was wrong: PATCH .../subscriptions/{id} with a new customerAddress. Forte recomputes the tax and updates the subscription's taxCents and amountCents.

Because Forte never prorates mid-period, a new address takes effect at the next renewal: changing it makes no charge now, so there is no card authorization to decline at edit time. The next off-session renewal charges the saved card the new amount, and follows the usual PAST_DUE → grace-period → retry path if it's declined. (A higher total can, rarely, change the outcome of that renewal, but only at the next renewal: never immediately.) On a PAST_DUE subscription you can send customerAddress together with a new paymentMethodId to recover it on the new card at the corrected total.

An omitted or null customerAddress leaves the existing address unchanged. There's no way to remove the address (and stop charging tax) through this call.

A subscription created without a customerAddress is taxed from the saved card's billing address at each renewal. If the card has no billing address either, the renewal is still charged, but without tax, and the payment's taxCalculationStatus is SKIPPED_NO_ADDRESS. If you're registered to collect sales tax, send customerAddress when you create the subscription so renewals are taxed.

Confirm the new total first. POST .../subscriptions/{id}/preview with the proposed { customerAddress } returns the recalculated subtotalCents, taxCents, amountCents, and the nextRenewalAt the new total applies to: read-only, with no charge and nothing saved. It reuses the subscription's current price and interval, so you send only the address you want to quote. This is the optional "confirm the totals" step for an address change; you can also PATCH directly.

Note this is distinct from POST .../subscriptions/preview (no {subscriptionId}), which quotes a brand-new subscription from full line items; the .../{subscriptionId}/preview form quotes a change to an existing one.

Triggers: what your services receive

Subscriptions reuse the same Payment Triggers you already configure: every renewal is a Payment. Only one new event exists, SUBSCRIPTION_STATUS_CHANGED, for the two lifecycle moments a payment event doesn't already cover.

EventFires when
PAYMENT_COMPLETEDThe first charge succeeds and every successful renewal (including a recovery charge after a failure). This is your grant/extend-access signal.
SUBSCRIPTION_STATUS_CHANGEDThe subscription transitions to PAST_DUE (ask the user to update their card) or to CANCELLED (revoke access). The state field tells you which.
PAYMENT_REFUNDEDA subscription charge is refunded/disputed through Stripe (same rules as one-off payments: your own API-initiated refunds don't fire it).

No separate "subscription created" event exists. The first PAYMENT_COMPLETED signals activation, so you grant access the same way you would for a one-off payment.

The exact events for each moment:

  • On create / activation → one PAYMENT_COMPLETED (for the first charge). Nothing else.
  • On each renewal → one PAYMENT_COMPLETED.
  • When a renewal fails (enters the grace period) → one SUBSCRIPTION_STATUS_CHANGED with state: "PAST_DUE", fired once on the ACTIVE → PAST_DUE transition (not once per retry). When a later retry (or a card update) succeeds, you get a single PAYMENT_COMPLETED: there is no separate "recovered"/"active again" event; the successful payment is the recovery signal.
  • On cancellation → one SUBSCRIPTION_STATUS_CHANGED with state: "CANCELLED" (whether the cancel came from DELETE, cancel-at-period-end, exhausting the grace period, or endTime). If the cancellation was caused by a refund/dispute, you also receive the corresponding PAYMENT_REFUNDED.

Trigger body

The POST body is the same shape as a payment trigger, with a few subscription-aware fields:

json
{
  "event": "SUBSCRIPTION_STATUS_CHANGED",
  "userId": "usr_...",
  "subscriptionId": "sub_...",
  "paymentTime": "2026-05-10T18:42:11.123Z",
  "state": "PAST_DUE"
}
  • event: PAYMENT_COMPLETED, PAYMENT_REFUNDED, or SUBSCRIPTION_STATUS_CHANGED.
  • state: for payment events, COMPLETED/REFUNDED; for subscription events, PAST_DUE/CANCELLED.
  • paymentId is present on payment events; subscriptionId is present on subscription events. PAYMENT_COMPLETED events for a subscription's first charge and its renewals carry both, so you can attribute a payment to its subscription.
  • A checkout that starts several subscriptions sends one PAYMENT_COMPLETED with a subscriptionIds array, and also subscriptionId when there is exactly one.

Make handlers idempotent on (event, paymentId|subscriptionId, state). Delivery, the X-Forte-Trusted header, and the retry policy are identical to payment triggers.

Sandbox and live

Subscriptions follow the same routing as Payments: sandbox projects charge the sandbox connected account in Stripe Test mode; live projects charge real cards once compliance is APPROVED.

Search

Search your resources, console pages, and documentation