Skip to content

Subscription billing

You want to charge a customer on a schedule and keep their access in step with what they've paid. With Flint you define a plan, attach a customer and a saved card, and Flint charges each cycle, retries failed payments, and sends a webhook for every state change. Each charge is a real order, so renewals get the same receipts, refunds, tax, fulfillment, and reporting as any other Flint sale.

Direct subscription creation requires a customer email in both customer account modes, or returns 409 CUSTOMER_EMAIL_REQUIRED.

Signup takes six steps. After it, you handle renewals, failed payments, pauses, cancellations, and plan changes. You can also move subscribers from another tool. To ship physical goods each renewal or sell subscribe-and-save across your catalog, continue with Subscriptions that ship once signup and renewals work.

Note: Signup without frontend code

Create a plan and a payment link for it. The link collects the buyer's details and card and starts the subscription. Renewals, failed payments, pauses, and cancellations work the same however the buyer signed up.

How subscription billing works#

Four objects make up a subscription:

ObjectWhat it holds
Subscription planReusable pricing: line items, billing interval, trial, setup fee, contract term, and for physical products the delivery methods subscribers can choose. One plan serves many subscribers. To sell subscriptions across your catalog instead of one fixed set of items, use a subscription offer.
CustomerWho is subscribed. Can hold a default payment method.
Payment methodA saved card Flint can charge while the customer isn't present.
SubscriptionOne customer on one plan or set of offers: its status, period dates, next billing date, who owns the schedule, and for physical products where each shipment goes.

Each billing cycle, Flint creates an order from the subscription (origin: "subscription", with subscription_id and subscription_cycle), charges the saved payment method, and sends webhooks for the outcome. Payments that start or renew a subscription carry the subscription fee in Processing fees.

Prices are locked at signup. A subscription copies its plan's line items and prices when it's created. Editing the plan later changes what new subscribers pay, never what existing ones pay. To move a subscriber to current prices, change their plan. Two things are priced fresh: shipping is quoted again on every renewal of a plan that ships, and a line added or swapped to another variant after signup takes that variant's price at the time of the change.

You choose who sets billing dates. With a flint schedule, Flint computes each date from the interval. With an external schedule, your integration supplies each date, and Flint waits after every paid cycle until you do. See Control the billing schedule.

Subscription statuses#

A subscription is always in one of seven statuses. Key your access logic on them, and on the events in step 6. Any status can also move to canceled when you cancel immediately, and a first payment that fails, including the first charge after a trial, moves a subscription to past_due.

Subscription status, main pathsStartFinal
  • incomplete moves to active on first payment succeeds
  • trialing moves to active on first charge succeeds
  • trialing moves to past_due on first charge fails
  • scheduled moves to active on first period paid
  • active moves to past_due on charge fails
  • past_due moves to active on retry succeeds
  • active moves to paused on pause
  • paused moves to active on resume
  • past_due moves to canceled on retries run out
  • active moves to canceled on cancel
  • active moves to canceled on end_after reached
status on subscription
Final values do not change again
  • scheduled
    Starts at starts_at. Nothing is charged before then. Don't provision yet.
  • incomplete
    The first period's payment is being collected, or is held for delivery or stock. Don't provision yet. Wait for subscription.activated.
  • trialing
    In a free trial with nothing charged, with or without a saved card. It stays trialing while the first charge after the trial is pending. Provision access.
  • active
    Paid and current. A subscription becomes active only after its first charge succeeds. Provision access.
  • past_due
    A charge failed and Flint is retrying. Keep or limit access, your call, and ask the customer for a working card.
  • paused
    Billing is suspended. pause_reason says why. Suspend access if your product pauses with billing.
  • canceledFinal
    Ended. Revoke access. A canceled subscription can't come back: create a new one if the customer returns.

The Subscriptions reference defines each status and the fields that go with it.

Choose your signup surface#

Signup is the only part of subscription billing with a frontend, so it's the main integration decision:

SurfaceUse it whenGuide
Payment link with subscription_plan_idYou want one public URL per plan, for a pricing page, ad, or QR code. No frontend code.Payment links
Checkout session with type: "subscription_plan"Your app starts signup for a known buyer and redirects them to a Flint-hosted page.Checkout sessions
Headless checkout with subscription_plan_idYour own signup UI collects a new card for the first charge or a trial.Headless subscription signup
Subscription APIYou save the card yourself, then create the subscription from your backend.Steps 1 to 6 below

The hosted surfaces create the customer and the subscription for you and report the result over the same webhooks. Hosted checkout creation and payment-link resolution return a checkout url and omit checkout_auth_token; headless checkout returns the credential instead of a hosted URL. If you use one, create the plan in step 1, then skip to step 6.

For a headless subscription checkout that acts for no customer, request an email code as the buyer leaves the email field with POST /v1/checkout-sessions/{checkout_session_id}/customer-verifications, the buyer's email, purpose: "save_payment_method", and channel: "auto". A 200 response puts the code step before card entry. 409 ACTION_NOT_ALLOWED with details[0].reason: not_offered shows no step. If the email changes, ask again on leaving the field. Keep handling 409 ACTION_NOT_ALLOWED with reason verification_required at payment as the backstop. Nothing is charged by that refusal. See Who the subscription belongs to for limits, disclosure, and the confirmation flow.

The subscription API flow runs across your server, Flint, and the buyer's browser:

Subscription signup through the APIResponse
BrowserYour serverFlintPOST /v1/customersPOST /v1/payment-methodspending payment method and client_setupsetup credentialsconfirm card setup with Stripe.jspayment_method.activatedPOST /v1/subscriptionssubscription.activated
  1. Your server sends POST /v1/customers to Flint
  2. Your server sends POST /v1/payment-methods to Flint
  3. Flint returns pending payment method and client_setup to Your server
  4. Your server sends setup credentials to Browser
  5. Browser sends confirm card setup with Stripe.js to Flint
  6. Flint returns payment_method.activated to Your server
  7. Your server sends POST /v1/subscriptions to Flint
  8. Flint returns subscription.activated to Your server

Send an Idempotency-Key header on each POST so a timed-out request can be retried without creating a second customer, card, or subscription. POST /v1/subscriptions requires one. See Idempotency.

Test your integration#

Billing runs on real time unless you put it on a test clock:

  • Create the customer on a test clock by sending test_clock_id to POST /v1/customers. That customer's subscriptions follow the clock, so you can advance it past a trial end, a renewal, or a payment retry instead of waiting. A clock holds up to 10 subscriptions that aren't canceled.
  • Use a daily plan for subscriptions off a clock, so renewals arrive within a day.
  • Pick the card for the scenario, with your flint_test_... key. succeeds at setup and on every renewal, asks for 3D Secure during card setup, and saves and then fails every charge, which runs the full past_due and retry path.

Test subscriptions and renewals walks through a trial and a failed renewal on a clock. Cancel test subscriptions when you're done so they stop billing.

Step 1: create a subscription plan#

A plan is what you'd show on a pricing page: a name, line items, and a billing interval. Create it once and reuse it for every subscriber. Amounts are integers in the currency's minor unit, so 2900 is $29.00.

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-plans \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: plan-pro-monthly-v1" \
  -d '{
    "name": "Pro Monthly",
    "billing_interval": "monthly",
    "billing_interval_count": 1,
    "currency": "USD",
    "trial_period_days": 14,
    "line_items": [
      {
        "type": "custom",
        "name": "Pro Plan",
        "unit_price_money": {"amount": 2900, "currency": "USD"},
        "quantity": 1
      }
    ]
  }'
Response
{
  "data": {
    "subscription_plan_id": "plan_1kmn0aExample",
    "name": "Pro Monthly",
    "status": "active",
    "billing_interval": "monthly",
    "billing_interval_count": 1,
    "currency": "USD",
    "trial_period_days": 14,
    "line_items": [
      {
        "subscription_plan_line_item_id": "spli_1kmn0aExample",
        "type": "custom",
        "name": "Pro Plan",
        "quantity": 1,
        "unit_price_money": {"amount": 2900, "currency": "USD"},
        "swap_variant_ids": []
      }
    ],
    "version": 1,
    "created_at": "2026-07-02T17:04:05Z"
  }
}

Save data.subscription_plan_id. The fields you'll decide on:

FieldWhat it does
billing_interval, billing_interval_countdaily, weekly, monthly, or yearly, and how many of them per cycle: monthly with a count of 3 bills quarterly.
line_itemsEach line is custom (a name and unit_price_money, as above), or sold from your catalog as variant with variant_id or bundle with bundle_id. Catalog lines can carry modifiers. A catalog line for a physical product ships every cycle; see Ship physical products.
trial_period_daysA free trial for every subscriber, up to 365 days. Plans with physical lines can't have one. See Free trials.
setup_fee_moneyA one-time fee charged when the subscription starts, in the plan's currency.
billing_interval_optionsLet the buyer choose a cadence. Configure an adjustable line for seat quantities. See Offer intervals and quantities.
contract_term_months, early_termination_fee_moneyA commitment of 1 to 120 months, and the fee you agree the buyer owes for leaving early. See Collect an early termination fee.
end_afterA default end for new subscriptions, in the cycles form: {"type": "cycles", "cycle_count": 12}. See End automatically.
statusactive (the default) or inactive. Create a plan as inactive to prepare it before you sell it.

The first billing period's charge of an API-created subscription, including a retry of that first charge, reports payment_flow: subscription_initial. Its setup fees use the same flow. Later periods report subscription_renewal. Each charge creates its own payment intent.

The setup fee decides whether the subscription starts. If the buyer's payment is declined, or a configuration problem means the fee can never be charged, Flint cancels the subscription. A temporary outage or a payment that's still processing doesn't cancel it: Flint keeps retrying, and the first recurring charge waits until the fee is paid. If Flint finds your account can't take payments before it charges the fee, it holds the fee and retries daily instead of canceling the subscription. If the subscription is canceled while the fee is still processing and that payment then succeeds, Flint refunds it.

To change a price, create a new plan and set the old one to inactive (Stop selling a plan). New buyers sign up on the new plan, and the old plan's subscribers keep renewing at their prices until you change their plan.

Step 2: create the customer#

The subscription needs a customer: who gets charged, emailed, and looked up in support.

cURL
curl -X POST https://api.withflintpay.com/v1/customers \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: customer-ada-001" \
  -d '{
    "name": "Ada Lovelace",
    "email": "ada@example.com"
  }'

Save data.customer_id. If your app already creates a Flint customer at account signup, reuse that ID.

Step 3: save a payment method#

Renewals charge the customer while they're away, so the card must be saved for later use, not only charged once. Start the setup from your backend:

cURL
curl -X POST https://api.withflintpay.com/v1/payment-methods \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: save-pm-ada-001" \
  -d '{
    "customer_id": "cus_1kmn0aExample"
  }'
Response
{
  "data": {
    "payment_method_id": "pm_1kmn0aExample",
    "customer_id": "cus_1kmn0aExample",
    "type": "card",
    "status": "pending",
    "client_setup": {
      "stripe": {
        "account_id": "acct_1AbcPlaceholder",
        "publishable_key": "pk_test_51AbcPlaceholder",
        "setup_intent": {
          "stripe_js_call": "confirm_setup",
          "client_secret": "seti_1AbcPlaceholder_secret_XyzPlaceholder"
        }
      }
    }
  }
}

The payment method exists now with status: "pending". It can't fund a subscription until the browser finishes setup and it becomes active.

In a sandbox, CI job, agent, or backend test with no browser, save a test card from a terminal instead, and skip to step 5 with the payment_method_id it returns.

Send client_setup.stripe.account_id, publishable_key, and setup_intent.client_secret to your frontend. setup_intent.stripe_js_call names the Stripe.js call to make with them. Flint processes cards on Stripe, so you don't need a Stripe account of your own, and your Flint API key never leaves your backend. Save a card and charge it later covers saved cards in more depth, including default cards and removal.

Step 4: confirm card setup in the browser#

Collect the card with the Stripe Payment Element and confirm the setup with the credentials from step 3. The card fields run in Stripe-hosted iframes, so card numbers never reach your servers.

HTML
<script src="https://js.stripe.com/v3/"></script>

<form id="setup-form">
  <div id="payment-element"></div>
  <button id="submit" type="submit">Save card</button>
  <div id="setup-message" role="alert"></div>
</form>
JavaScript
// From your backend (step 3): publishableKey, accountId, clientSecret.
const stripe = Stripe(publishableKey, {
  stripeAccount: accountId, // required: the setup lives on this account
});

const elements = stripe.elements({ clientSecret });
const paymentElement = elements.create("payment");
paymentElement.mount("#payment-element");

const form = document.querySelector("#setup-form");
form.addEventListener("submit", async (event) => {
  event.preventDefault();

  const { error, setupIntent } = await stripe.confirmSetup({
    elements,
    confirmParams: {
      return_url: "https://example.com/billing/setup-complete",
    },
    redirect: "if_required",
  });

  if (error) {
    // A validation problem or a refused card: show it and let them retry.
    document.querySelector("#setup-message").textContent = error.message;
    return;
  }

  if (setupIntent.status === "succeeded") {
    // Tell your backend. It creates the subscription once the card is active.
    await fetch("/billing/subscribe", { method: "POST" });
  }
});

confirmSetup runs 3D Secure in place when the bank asks for it. With redirect: "if_required", card setups finish without leaving your site, and return_url is used only by redirect-based methods. An integration on the legacy Card Element can call stripe.confirmCardSetup(clientSecret, { payment_method: { card } }) instead.

Wait for the payment method to activate#

The browser finishing isn't the end of setup. Moments later, Flint finalizes the card: its status changes from pending to active, its card details (brand, last 4 digits, expiry) fill in, and Flint sends payment_method.activated. Create the subscription after one of these signals:

  • Webhook (recommended). Create the subscription when payment_method.activated arrives for this payment_method_id.
  • Polling. Call GET /v1/payment-methods/{payment_method_id} until data.status is active.

Creating a subscription with a pending card fails with 409 ACTION_NOT_ALLOWED, reason status_not_reached, and creates nothing. Once the card is active, send the request again; the refusal's next_steps says whether you can reuse its Idempotency-Key.

If the bank refuses the setup, the payment method becomes failed. Failed payment methods don't retry: start again from step 3.

To let later subscriptions omit payment_method_id, make the card the customer's default:

cURL
curl -X PATCH https://api.withflintpay.com/v1/customers/cus_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"default_payment_method_id": "pm_1kmn0aExample"}'

The card must be active with usage: "off_session". Changing the default doesn't move subscriptions that already exist; Choose a default card has the rules.

Step 5: create the subscription#

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: sub-ada-pro-001" \
  -d '{
    "terms": {
      "type": "subscription_plan",
      "subscription_plan_id": "plan_1kmn0aExample"
    },
    "customer_id": "cus_1kmn0aExample",
    "payment_method_id": "pm_1kmn0aExample",
    "billing_start": {"type": "immediate"},
    "billing_schedule": {"owner": "flint"}
  }'
Response
{
  "data": {
    "subscription_id": "sub_1kmn0aExample",
    "terms_type": "subscription_plan",
    "subscription_plan_id": "plan_1kmn0aExample",
    "customer_id": "cus_1kmn0aExample",
    "payment_method_id": "pm_1kmn0aExample",
    "payment_method_due_at": null,
    "status": "trialing",
    "billing_schedule_owner": "flint",
    "is_awaiting_billing_schedule": false,
    "billing_interval": "monthly",
    "billing_interval_count": 1,
    "billing_anchor_day": 16,
    "cancel_at_period_end": false,
    "trial_end_at": "2026-07-16T17:04:05Z",
    "current_period_start_at": "2026-07-16T17:04:05Z",
    "current_period_end_at": "2026-08-16T17:04:05Z",
    "next_billing_at": "2026-07-16T17:04:05Z",
    "completed_cycles": 0,
    "line_items": [
      {
        "subscription_line_item_id": "sli_1kmn0aExample",
        "name": "Pro Plan",
        "quantity": 1,
        "unit_price_money": {"amount": 2900, "currency": "USD"},
        "subtotal_money": {"amount": 2900, "currency": "USD"}
      }
    ],
    "recurring_subtotal_money": {"amount": 2900, "currency": "USD"},
    "version": 1,
    "created_at": "2026-07-02T17:04:05Z"
  }
}

The plan has a 14-day trial, so the subscription starts trialing. During the trial, current_period_start_at and current_period_end_at describe the first paid period, which begins when the trial ends. Without a trial, an immediate start returns incomplete while Flint collects the first payment. Neither response proves payment: grant paid access from webhooks.

terms is required and says what the subscription bills. Its type picks one of two branches, and a field from the other branch fails with 400 INVALID_REQUEST, detail code UNKNOWN_FIELD:

terms.typeFieldsBills
subscription_plansubscription_plan_id (required); optional billing_interval with billing_interval_count, and line_itemsOne plan. Omit the interval pair for the plan's own interval. Line overrides name distinct subscription_plan_line_item_id values in that plan, each with quantity from 1 to 9,999. Omitted lines keep their defaults. Scalar terms.quantity is no longer accepted.
subscription_offerbilling_interval, billing_interval_count, and line_items (all required)Variant lines from subscribe-and-save offers.

Choose seats at signup#

Read the plan's line_items and use the ID of the line marked allow_quantity_adjustment: true as the seat line. Set its quantity in the create request so the first payment bills every seat:

JSON
{
  "customer_id": "cus_1kmn0aExample",
  "terms": {
    "type": "subscription_plan",
    "subscription_plan_id": "plan_1kmn0aExample",
    "line_items": [
      {"subscription_plan_line_item_id": "spli_1kmn0aExample", "quantity": 7}
    ]
  },
  "billing_start": {"type": "immediate"}
}

At $10.00 per seat, that line charges $70.00 before modifiers, discounts, and tax. Other lines, such as a base fee, keep their plan quantities. Merchant requests may override any plan line from 1 to 9,999, including outside its buyer bounds. Put the same create body in subscription on POST /v1/subscription-previews with mode: "create" to preview the first and recurring charges.

For checkout create or PATCH, send subscription_terms.line_items with the same two fields. A checkout credential can change only the frozen adjustable line and must obey its min_quantity and max_quantity; absent bounds mean 1 and 9,999. A merchant credential can set any line within 1 through 9,999. Read subscription_terms.line_items to discover the IDs and policy. Payment-link buyers read subscription_preview.line_items and send their choices in subscription_terms.line_items on resolve.

The other fields sit beside terms and work the same for both branches:

  • customer_id (required). A customer can hold several subscriptions, including more than one to the same plan.
  • payment_method_id. An active, off-session card that belongs to the customer. Omit it to use the customer's default. With neither, the call fails with 400 INVALID_REQUEST, detail code REQUIRED, param payment_method_id, unless the start is imported, which can be created without a card, or a plan trial with nothing to charge at creation, which can start without one. A card of another customer, or one usable only with the buyer present, fails with detail code NOT_ALLOWED.
  • billing_start (required). immediate, scheduled, or imported. See Choose when billing starts.
  • billing_schedule.owner. flint or external. Omit it to use your subscription settings' default.
  • billing_anchor_day. See Billing anchor day.
  • end_after. When the subscription ends on its own. Omit it to take the plan's default, or send null for no end. See End automatically.
  • prorate_first_period. Defaults to false. Set it to true to charge for the shorter first paid period of an anchored subscription. See Prorate the first paid period.
  • delivery. Where each shipment goes. Required when anything on the subscription ships, and rejected otherwise. See The delivery preference.
  • service_location. The address where you perform the work, for a subscription to a service at a place. Send a saved address ({"type": "customer_address", "customer_address_id": "caddr_..."}) or an inline one ({"type": "address", "address": {...}}). Flint copies the address, so later edits to the customer's address book don't change it.
  • metadata and external_reference_id. Your own references. Set external_reference_id to your ID for the subscription so you can find it with GET /v1/subscriptions?external_reference_id=.

On the response, line_items is the price snapshot this subscription bills every cycle, whatever later happens to the plan. Each line has a stable subscription_line_item_id, and stores its quantity, including any signup override. There is no subscription-level quantity multiplier. terms_type records which branch created the subscription. It never changes, and it's on every response and webhook payload.

payment_method_id and payment_method_due_at are on every merchant and buyer subscription response and subscription.* webhook object, and both can be null. A subscription without a card has payment_method_id: null; see Import without a card and Trial without a card. Read both fields as nullable before you use them.

Billing anchor day#

billing_anchor_day (1 to 31) is the day of the month that monthly and yearly renewals bill on. New Flint-owned subscriptions use the store's time zone at creation, or UTC if none is set. Changing the store's time zone does not move existing subscriptions. Subscriptions created under UTC billing keep their UTC schedule.

The anchor defaults to the day the first paid period starts in the billing time zone: the signup day, the trial's end, the starts_at day of a scheduled start, or the period_started_at day of an import. Renewals follow the local clock as daylight saving time changes. If a month is shorter than the anchor, the renewal bills on the month's last day and returns to the anchor afterward. For example, an anchor of 31 bills January 31, February 28 (February 29 in a leap year), March 31, then April 30.

Send it only with an explicit "billing_schedule": {"owner": "flint"}, because an external schedule sets each date itself. Daily and weekly billing reject it with 400 INVALID_REQUEST, detail code NOT_ALLOWED.

By default, an anchor leaves the first period at the full price. It runs from its start to the anchor day one interval later, so it can be shorter or longer than a full interval. Monthly billing that starts July 10 with an anchor of 25 first renews August 25. An import is the exception: its first period ends one full interval after period_started_at, and renewals after that bill on the anchor day.

Prorate the first paid period#

Send prorate_first_period: true on POST /v1/subscriptions, alongside billing_anchor_day and "billing_schedule": {"owner": "flint"}. It requires monthly or yearly billing and nothing that ships. An imported billing start is not eligible. Each of these ineligible combinations returns 400 INVALID_REQUEST, detail code NOT_ALLOWED, with param: prorate_first_period. Omitting the flag or sending false keeps the default behavior above; null is rejected.

JSON
{
  "customer_id": "cus_1kmn0aExample",
  "terms": {"type": "subscription_plan", "subscription_plan_id": "plan_1kmn0aExample"},
  "billing_start": {"type": "immediate"},
  "billing_schedule": {"owner": "flint"},
  "billing_anchor_day": 25,
  "prorate_first_period": true
}

The first paid period ends at the nearest future anchor day in the current or next month, clamped to that month's last day. This applies even to yearly billing or an interval count greater than 1. Full intervals repeat from that boundary. A trial uses its end as the first paid start; a scheduled subscription uses starts_at. Starting on the anchor day buys a normal full period at the full price. Setup fees remain separate and are charged in full.

The first item charge is round(N × u / p), rounded half up once:

  • N is the full interval's item subtotal after the cycle's promotions.
  • u is the number of seconds from the first paid start to its anchor boundary.
  • p is the number of seconds in the full anchored interval ending at that boundary, using the interval and count chosen at creation.

Flint uses actual calendar dates, including short months and leap years. The unpaid part of the full interval before the paid start appears on the order as a discount with source proration. Flint calculates tax on the resulting amount.

For example, a $50 monthly subscription starts July 10 at noon UTC, anchored to the 25th. Its paid coverage is July 10 to July 25. The full interval for pricing is June 25 to July 25, so the first item charge is $25 for 15 of 30 days. The July 25 renewal bills $50 for a full month. If the same subscription billed yearly with a day-of-month anchor of 25, the first boundary is still July 25; its pricing interval ends there and starts July 25 of the preceding year.

Before that first payment is paid, changing the interval, interval count, or anchor returns 409 ACTION_NOT_ALLOWED, reason first_period_unpaid, with the message "Change this subscription's billing interval after its first prorated payment." A plan change that keeps those terms is allowed. The same refusal applies to changing the interval through PATCH or the anchor through billing_schedule, including an implicit anchor change when rescheduling a trial. To move a trial conversion from July 10 to July 12 while keeping its anchor on the 25th, send billing_anchor_day: 25 again. That keeps the calendar terms and is allowed. Other lifecycle and schedule validations still apply.

After the first payment, normal interval and anchor changes resume. While the original first paid coverage is still current, prorated_now changes use the original full interval for their new charge, even if the interval or anchor has since changed. For the $50 example, changing to $100 halfway through July 10 to July 25 charges $25 for the remaining 7.5 days, less $12.50 unused credit, for $12.50 before tax. A further partial payment in that period keeps the same original pricing interval. The next actual paid period uses its new terms. Collection and previews require the original creation terms; if those terms are missing or conflict with an unpaid subscription, Flint refuses the calculation instead of inferring them from its current terms.

Every Subscription response, including webhook snapshots, returns the creation flag as prorate_first_period. Before creation, a create subscription preview prices the prorated first period and the full period after it; see Import subscribers from another tool. Ineligible combinations come back in its errors with detail code NOT_ALLOWED and param: subscription.prorate_first_period. After creation, next_renewal estimates the first prorated items and tax while unpaid, excluding the separate setup fee. After the first payment, it estimates the full renewal. This next_renewal estimate uses the same calendar and rounding rules as collection.

Changes after signup treat the anchor differently. A now plan change starts a new period and sets the anchor to that day. A prorated_now plan change or a quantity change billed now keeps the period, the anchor, and completed_cycles, and charges only for the rest of the period. See Prorated charges.

Choose when billing starts#

billing_start takes exactly one of three branches, each with only its own fields:

typeFieldsWhat happens
immediateNoneStarts now. Without a trial, Flint collects the first period right away.
scheduledstarts_atStarts at a future time. Flint creates no order and charges nothing before then. Can't be combined with a plan trial (400 INVALID_REQUEST, detail code NOT_ALLOWED), and a past starts_at fails on billing_start.starts_at.
importedperiod_started_at, optional completed_cyclesContinues a period the buyer already paid for elsewhere, without charging. Give the start of that period; Flint computes its end from the interval. A period that has already ended fails on billing_start.period_started_at.

A scheduled subscription reports status: "scheduled" and starts_at. At starts_at, Flint collects the first period, and the subscription becomes active once it's paid or past_due if the payment fails. It can still read scheduled for the few seconds that charge takes. If Flint finds your account can't take payments before it charges the first period, the subscription stays scheduled and Flint retries the charge daily. A delivery hold or a wait on stock makes it incomplete instead.

Use imported when you move subscribers from another billing system; it's what keeps a buyer from paying twice for a month they already paid for. An imported subscription can be created before the subscriber has a card; see Import without a card. A trial with nothing to charge at creation can also start without one; see Trial without a card. Other starts need a card at creation. completed_cycles includes the current imported period and must be at least 1. If omitted, it defaults to 1, and the first renewal has subscription_cycle: 2. Send a larger count to continue the billing history from the previous system. An import accepts end_after like any other create, and a cycles end counts the carried-in completed_cycles. With a flint schedule, the first charge is at the end of the imported period. With an external schedule, the subscription reports is_awaiting_billing_schedule: true until you set next_billing_at.

Set period_start to the start of the period the subscriber already paid for. That period must cover the current time, or Flint refuses it with 400 INVALID_REQUEST. This sample uses four days ago on a monthly plan. GNU date sets it below; on macOS, use date -u -v-4d +%Y-%m-%dT00:00:00Z.

Shell
period_start=$(date -u -d '4 days ago' +%Y-%m-%dT00:00:00Z)

curl -X POST https://api.withflintpay.com/v1/subscriptions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: import-sub-ada-pro-001" \
  -d '{
    "terms": {
      "type": "subscription_plan",
      "subscription_plan_id": "plan_1kmn0aExample"
    },
    "customer_id": "cus_1kmn0aExample",
    "payment_method_id": "pm_1kmn0aExample",
    "billing_start": {
      "type": "imported",
      "period_started_at": "'"$period_start"'",
      "completed_cycles": 6
    },
    "billing_schedule": {"owner": "flint"},
    "external_reference_id": "legacy-sub-8812"
  }'

Never use immediate to move an existing subscriber: it collects the first payment now, and a buyer who already paid for the current period pays twice. To check a whole batch before you create anything, see Import subscribers from another tool.

Step 6: grant access from webhooks#

Subscriptions change on Flint's schedule, not during your API calls: trials end overnight, renewals succeed or fail, retries run out. Webhooks keep your access logic current. Register an endpoint once:

cURL
curl -X POST https://api.withflintpay.com/v1/webhook-endpoints \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: webhook-billing-001" \
  -d '{
    "url": "https://example.com/webhooks/flint",
    "enabled_events": [
      "subscription.created",
      "subscription.updated",
      "subscription.activated",
      "subscription.trial_ending",
      "subscription.renewal_upcoming",
      "subscription.end_upcoming",
      "subscription.payment_succeeded",
      "subscription.past_due",
      "subscription.dunning_exhausted",
      "subscription.paused",
      "subscription.resumed",
      "subscription.cycle_skipped",
      "subscription.plan_changed",
      "subscription.cancellation_scheduled",
      "subscription.reactivated",
      "subscription.canceled",
      "payment_method.activated"
    ]
  }'

Subscriptions that ship goods also send subscription.delivery_action_required, subscription.delivery_pause_upcoming, and subscription.delivery_updated. Add them to enabled_events if you handle deliveries; Delivery webhooks describes each one.

Save data.webhook_endpoint_id: it's the audience you check when you verify each delivery against Flint's public JWKS.

A minimal access handler needs three rules:

  1. Provision on subscription.activated, or on subscription.created when the status is trialing.
  2. Ask for a new card on subscription.past_due.
  3. Revoke on subscription.canceled.

Each event carries the subscription in data.object as it was when the event was prepared, including supported_actions. Deliveries can repeat and arrive out of order, so before you grant or revoke access, fetch the subscription with GET /v1/subscriptions/{subscription_id} and act on its current status.

If you sell both plans and offers, branch on terms_type before deciding what the subscription grants. A subscription_plan subscription carries subscription_plan_id; a subscription_offer subscription doesn't. See Entitlements for offer subscriptions.

  • subscription.created
    A subscription was created on any surface: the API, a checkout session, a payment link, or a paid order with subscribed lines.
  • subscription.activated
    The first paid period was collected, or the subscription was created already paid or imported. Sent once per subscription. This is the signal to provision paid access. A trial sends it after the first charge succeeds, not when the trial ends. If that charge is declined, it follows the successful retry.
  • subscription.trial_ending
    A trial is approaching its end.
  • subscription.renewal_upcoming
    The next renewal is approaching. Rescheduling sends a new reminder for the new date. A subscription in its final cycle sends subscription.end_upcoming instead.
  • subscription.end_upcoming
    The subscription ends at the close of its current period because of end_after, or after its last paid delivery if that comes later. It takes the place of subscription.renewal_upcoming in the final cycle.
  • subscription.payment_succeeded
    A cycle's charge succeeded. The cycle's order also sends order.paid.
  • subscription.past_due
    A charge failed and the subscription entered past_due. Sent once per billing cycle; failed automatic retries send nothing more.
  • subscription.dunning_exhausted
    Automatic retries ran out, or a permanent decline stopped them. status shows the end action: canceled, paused, or still past_due. After a permanent decline, status stays past_due until the retry window closes.
  • subscription.paused
    The subscription paused: by request, when dunning ended under a pause policy, or after a delivery hold ran out.
  • subscription.resumed
    Flint applied a resume. The status can be past_due while an overdue period is collected; grant paid access only when it's active.
  • subscription.cycle_skipped
    The buyer or you skipped a renewal.
  • subscription.plan_changed
    You moved the subscription to another plan, or to its own plan's current prices.
  • subscription.cancellation_scheduled
    The subscription is set to cancel. It carries cancel_at_period_end, scheduled_cancel_at, and cancellation_details.
  • subscription.reactivated
    A scheduled cancellation was undone.
  • subscription.canceled
    The subscription ended. When end_after ended it, cancellation_reason is end_after_reached.
  • subscription.updated
    Something changed that no more specific event above describes: metadata, external_reference_id, quantity, interval, payment method, line items, the billing schedule, an upcoming delivery hold set or cleared, or a resume accepted or refused. A trial ending sends nothing by itself. Flint sends the more specific event alone when a write triggers one.
  • payment_method.activated
    A saved card finished setup and can be charged.

Physical subscriptions send more events; see Delivery webhooks.

How renewals work#

At next_billing_at, Flint creates an order from the subscription's line items, charges the saved payment method, and moves the period forward. You get subscription.payment_succeeded with the new current_period_start_at and current_period_end_at, and order.paid for the cycle's order. A flint schedule then computes the next next_billing_at. An external schedule clears it and reports is_awaiting_billing_schedule: true until you supply the next date.

Before each renewal, Flint sends subscription.renewal_upcoming and emails the buyer: three days ahead, or 30 days ahead for a subscription that renews yearly or every 12 months or more. In the final cycle of a subscription with end_after, there is no renewal to announce. Flint sends subscription.end_upcoming and an ending notice at that point instead.

next_billing_at is present only while a renewal is scheduled: on a trialing or active subscription that isn't set to cancel. Other states use their own field for "what happens next":

StateRead
past_duenext_retry_at for the next payment retry, and missed_billing_at for the billing date that failed
Paused for a set lengthscheduled_resume_at
scheduledstarts_at
Set to cancelscheduled_cancel_at
Set to end with end_afterexpires_at, and remaining_cycles for the charges left. See End automatically.

Because every cycle is an order:

  • Refund a cycle with the refunds API against that cycle's order.
  • Reports and reconciliation see subscription revenue like any other sale. Filter orders by subscription_id, or by origin of subscription.
  • The buyer gets a receipt email for each cycle, and each paid cycle has a numbered PDF receipt. See Download receipts.
  • On a plan that ships, the renewal order also carries the delivery destination and a shipping charge, and gets a fulfillment. See What a physical renewal does.

Tax on subscriptions#

Each renewal, setup fee, and plan change order takes its tax from the subscription's tax. A subscription without one, "tax": null on reads, follows your settings: tax.default_enabled decides whether its orders calculate tax, and tax.default_calculation how. Set tax to give a subscription its own:

Response
{
  "tax": {
    "enabled": true,
    "calculation": {"mode": "external", "components_source": "callback"}
  }
}
  • enabled is required. false bills without tax whatever your settings say.
  • calculation is {"mode": "automatic"} or {"mode": "external", "components_source": "callback"}, and is allowed only while enabled is true. Flint creates the subscription's orders, so external tax needs your tax calculation callback to supply them. Leave it out, or send null, to use tax.default_calculation, where a provided default means automatic.
  • Set it when you create the subscription or with PATCH. It's replaced as a whole, and "tax": null in a PATCH clears it so the subscription follows your settings again. Orders Flint creates after the change use it; an open renewal order keeps the tax it was created with. Buyers can't change it and don't see it.
  • A plan checkout copies it. A subscription that a subscription plan checkout session or payment link creates takes the tax that session or link set. When it set none, the subscription follows your settings.
  • Callback tax needs a selected callback. Setting callback tax while no callback is selected in tax.calculation_callback_id returns 409 ACTION_NOT_ALLOWED with reason configuration_required and resource_type tax_calculation_callback.

When your callback can't price a renewal, because it fails, times out, or answers badly, Flint holds the renewal instead of charging: no payment is attempted, the subscription doesn't become past_due, and dunning doesn't start. Flint tries again after an hour, then backs off to once a day. A setup fee is held the same way. Calls that charge while you wait, a plan change or quantity change billed now and POST /v1/subscriptions/{subscription_id}/renew, return 502 EXTERNAL_SERVICE_ERROR with reason tax_callback_failed instead, and 409 ACTION_NOT_ALLOWED with reason configuration_required and resource_type tax_calculation_callback when no callback is selected. If no callback is selected, a renewal is held and tried once a day, but a setup fee, a first payment, or a dunning retry fails as other configuration problems do. Fix the endpoint or select a callback, and the next attempt charges as usual. Next-charge estimates and previews don't call your callback: on a subscription with callback tax, their tax_money is null, as when tax can't be calculated yet.

A subscription order's delivery destination can change after payment when its tax stays the same. With callback tax, Flint asks your callback about the new destination, as it calculates automatic tax again, and refuses the change if the tax would differ.

Subscribers stay on their delivery method when you revoke its configuration during an incident. A subscription doesn't pin a method revision, so each renewal quotes the method as it is then. While the revocation applies, the renewal is held without charging, with delivery_hold.reason method_unavailable and subscription.delivery_action_required. If the plan offers no other method, the hold reports fixable_by: "merchant", since the buyer has nothing to switch to. Publish a corrected revision, rotate the callback secret, or fix the Location's address, and the next check charges and ships the held renewal. To move subscribers instead, use a delivery method migration; a revoked method can't be the migration's target or be added to a plan or a subscription.

Download receipts#

Every paid subscription charge has a numbered PDF receipt, so a buyer's accounts-payable team can file one document per charge. The receipt belongs to the charge's order. That covers the signup charge, each renewal, a change-plan now charge, and any other order a subscription charges. A zero-amount order that only ships an already-paid cycle has no receipt; the order that collected the payment does.

Download a receipt with the same routes as any order:

CallerRoute
Your serverGET /v1/orders/{order_id}/receipt-pdf, with an API key that has commerce.orders.read
The buyerGET /v1/me/orders/{order_id}/receipt-pdf, with the buyer's customer session

The receipt number is the order's order_number. Besides the order's lines, discounts, tax, and payments, a subscription receipt shows:

  • The plan name, the subscription_cycle, and the period the charge covers.
  • Your tax identity and the buyer's, when each has one. Flint records both when the charge is paid. A tax ID you add to the customer later appears only on later charges, and receipts already issued keep what they showed.
  • The customer-facing name of each discount, such as the unused-time credit on a plan change.

Flint records the plan name when it makes a charge, so renaming a plan later doesn't change the receipts of earlier charges. A receipt for a charge made before Flint recorded the name shows the plan's current name.

To list a subscription's receipts, filter orders by the subscription: GET /v1/orders?subscription_id=sub_1kmn0aExample for your server and GET /v1/me/orders?subscription_id=sub_1kmn0aExample for a buyer. There is no separate receipt list. Each order's subscription_cycle says which cycle it charged.

cURL
curl "https://api.withflintpay.com/v1/orders?subscription_id=sub_1kmn0aExample" \
  -H "Authorization: Bearer YOUR_API_KEY"

curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/receipt-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o receipt-1042.pdf

A receipt follows the availability rules in Receipts and buyer links: it exists once the order has a successful payment or gift card redemption, including after a refund. An order without one returns 409 ACTION_NOT_ALLOWED. This is a receipt for a card or gift card payment, not a document for invoices collected offline.

Control the billing schedule#

billing_schedule_owner says who supplies billing dates:

  • flint. Flint computes each date from the interval and billing_anchor_day.
  • external. Your integration sets each next_billing_at. Without one, Flint waits, and the status doesn't change.

To change the schedule, send the whole billing_schedule with PATCH /v1/subscriptions/{subscription_id}. owner is always required, and billing_schedule must be the only change in the request: another field beside it fails with 400 INVALID_REQUEST and one NOT_ALLOWED detail per field you sent. The detail is at whichever of the two inputs sorts later, usually the other field, such as param: "metadata" with conflicting_fields: ["billing_schedule"]. Add expected_version to apply the change only to the version you read.

next_billing_at must be in the future. This sample uses 15 days from now. GNU date sets it below; on macOS, use date -u -v+15d +%Y-%m-%dT16:00:00Z.

Shell
next_billing=$(date -u -d '15 days' +%Y-%m-%dT16:00:00Z)

curl -X PATCH https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: schedule-sub-ada-002" \
  -d '{
    "billing_schedule": {
      "owner": "external",
      "next_billing_at": "'"$next_billing"'"
    },
    "expected_version": 4
  }'
  • Move a Flint-owned date. Send owner: "flint" with the new next_billing_at. Later renewals follow the new date: billing_anchor_day becomes its day of the month, so moving a monthly renewal to September 25 bills next on October 25. To keep a different anchor, send billing_anchor_day inside billing_schedule: moving a renewal to February 28 with billing_anchor_day: 31 returns to the 31st in March.
  • Move a trial's end. On a trialing subscription, send owner: "flint" with the new next_billing_at. The trial now ends on that date, and the first paid period starts then. Flint recomputes that period's end and reschedules the trial-ending notice. If cancel_at_period_end is set, cancellation moves to the new trial end instead of collecting a payment. Changing an external-owned date keeps the trial end as it was.
  • Clear an external date. Send {"owner": "external", "next_billing_at": null}. The subscription keeps its status, reports is_awaiting_billing_schedule: true, and stamps billing_schedule_waiting_started_at. List these with GET /v1/subscriptions?billing_schedule_owner=external&is_awaiting_billing_schedule=true. An external schedule doesn't take billing_anchor_day (detail code UNKNOWN_FIELD).
  • Move a start that hasn't arrived. Keep the same owner and send a new next_billing_at. Clearing the date or changing the owner before the start is refused.

If trial conversion is already in progress, moving the trial's end returns 409 OPERATION_IN_PROGRESS with retryable: true. The schedule stays as it was. Retry after the conversion finishes.

Flint checks each schedule change against these rules. Errors name the field inside the schedule, such as billing_schedule.next_billing_at:

RuleWhen it fails
The subscription isn't canceled, past_due, or incomplete.409 ACTION_NOT_ALLOWED, reason terminal_status for canceled, unsupported_state otherwise
next_billing_at is in the future, and not before current_period_start_at, except when moving a Flint-owned trial's end.400 INVALID_REQUEST, detail code INVALID_VALUE
A flint schedule moves at most one billing interval past current_period_end_at. External schedules have no limit.400 INVALID_REQUEST, detail code INVALID_VALUE. Move it in steps, or hand the schedule to external.

A schedule change returns the subscription and sends one subscription.updated when a value changed. A change to the values already stored returns the subscription unchanged and sends nothing.

Skip a renewal#

On prepaid subscriptions, a skip defers one delivery and the next charge by one delivery interval. It consumes no paid delivery.

POST /v1/subscriptions/{subscription_id}/skip-cycle skips the next renewal. Nothing is charged or shipped for it, and next_billing_at moves one of the subscription's own intervals later (on billing_anchor_day for monthly and yearly billing on a flint schedule). The current period grows to cover the skipped one. The anchor doesn't change, so a monthly subscription anchored on the 31st that skips January 31 bills next on February 28, then March 31.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/skip-cycle \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: skip-sub-ada-001" \
  -d '{"initiated_by": "buyer"}'

The subscription must be active, not set to cancel, and have a next_billing_at. Otherwise the skip fails with 409 ACTION_NOT_ALLOWED, reason unsupported_state, or terminal_status when canceled. initiated_by is buyer, merchant (the default), or integration. It records attribution and sets the wording of Flint's skip email, which Flint sends only for a subscription that ships. Send buyer when you skip at the buyer's request. This field does not apply the store's buyer limits. To enforce them, use a customer session on POST /v1/me/subscriptions/{subscription_id}/skip-cycle; that route always records buyer and does not accept initiated_by. A skip sends subscription.cycle_skipped and no other webhook event.

A skip charges nothing, so it doesn't use up a cycle. On a subscription that ends with end_after in the cycles form, the end moves one interval later with the skipped period. A date end stays where it is, so a skip can leave one less charge before it.

Buyers can skip their own renewals with POST /v1/me/subscriptions/{subscription_id}/skip-cycle on a flint schedule; see Buyer self-service.

To compare skipping with pausing, see Pause, skip, and resume subscriptions.

When a renewal payment fails#

Cards expire, limits get hit, and banks decline. A failed charge starts a recovery path that Flint runs for you:

  1. What happens: A renewal charge fails
  2. Flint sends: subscription.past_due
    The subscription is past_due. next_retry_at says when Flint retries, and Flint emails the buyer a payment-failure notice.
  3. What happens: Flint retries on days 1, 4, 9, and 16 by default
  4. Flint sends: subscription.payment_succeeded
    A retry succeeded. The subscription is active again and the period moves forward. If the declined charge was a trial's first charge, Flint also sends subscription.activated, exactly once.
  5. What happens: An automatic retry fails and another retry is scheduled
  6. Flint sends: subscription.updated
    version advances and next_retry_at gives the new retry date.
  7. What happens: Every retry fails
  8. Flint sends: subscription.dunning_exhausted
    Retries ran out. status shows the end action.
  9. What happens: A charge is declined permanently
  10. Flint sends: subscription.dunning_exhausted
    Retries stop. The subscription stays past_due until the retry window closes, then takes the end action.
  • Retry window. dunning_retry_days in subscription settings sets the window, 16 days by default, and Flint scales the retries to fit it.
  • Permanent declines. A renewal or retry that fails with expired_card, lost_card, stolen_card, fraudulent, authentication_required, card_declined_do_not_retry, or card_details_outdated gets no more automatic retries, because no retry can succeed until the customer acts. Flint sends subscription.dunning_exhausted right away, with the subscription still past_due, and waits for the customer to add a working card until the retry window closes: dunning_retry_days after the renewal first failed, the day the last retry would have run. Then it applies the end action. Later declines, including failed payment retries, don't extend the window. A payment retry that succeeds before the window closes recovers the subscription, and no end action runs. card_declined_do_not_retry means the issuer said not to charge the card again, so a recurring charge needs the buyer's new authorization and a different payment method.
  • Interrupted billing. If billing recovers from an interruption while a retry is scheduled, the window counts from the billing date that failed, missed_billing_at. That window can be shorter than the original one when the failed charge ran after its billing date. A subscription already waiting for a new card when billing recovers keeps waiting without a deadline.
  • End action. cancel, pause, or notify_only, set separately for each schedule owner. Flint-owned subscriptions default to cancel; external ones default to notify_only, which leaves the subscription past_due for you to recover. It runs when the last retry fails, or when the window closes after a permanent decline.
  • Late payment. On a flint schedule, a payment collected more than 24 hours after its due date starts a new period on the payment day and moves billing_anchor_day to that day. A payment within 24 hours keeps the schedule.

Each failed automatic retry that changes next_retry_at advances version and sends subscription.updated with the new date. Clearing the date after a permanent decline also advances version and sends subscription.updated. When the final retry, or the window closing after a permanent decline, cancels or pauses the subscription, that change sends its specific events without a separate subscription.updated. A permanent decline's end action doesn't send subscription.dunning_exhausted a second time.

While a subscription is past_due, outstanding_money is what a retry will collect, and last_payment_error describes the latest decline. last_payment_error is a linked field read from the renewal order and its payment intent. It is outside the subscription's version and changes without its own subscription event. Refetch it after the renewal order's order.* events, which carry subscription_id, or payment_intent.payment_failed.

Recover with a new card#

A past-due subscription recovers when a charge succeeds, so the fix is a working card. Have the customer save a new card (steps 3 and 4), then point the subscription at it:

cURL
curl -X PATCH https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: card-sub-ada-002" \
  -d '{"payment_method_id": "pm_0newcardExample"}'

The card must be active and belong to the subscription's customer. A card still in setup fails with 409 ACTION_NOT_ALLOWED, reason status_not_reached, and changes nothing; send the change again with a new Idempotency-Key once the card is active.

Flint always charges the subscription's current card, so the next scheduled retry uses the new one. To charge now, start a payment retry:

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/payment-retries \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: retry-sub-ada-001" \
  -d '{}'

The body must be empty or {}, and Idempotency-Key is required. The 201 response is a retry with subscription_payment_retry_id and status: "pending". Read it with GET /v1/subscriptions/{subscription_id}/payment-retries/{subscription_payment_retry_id}: it moves through processing to succeeded, with the order_id and payment_intent_id it produced, or failed, with last_payment_error. payment_intent_id is set when the retry starts its charge and is available on merchant and buyer reads. It is omitted before charging starts or when the retry creates no payment intent. The retry is a command to charge again; read its payment intent for the payment's status and history. List a subscription's retries, newest first, with GET /v1/subscriptions/{subscription_id}/payment-retries.

  • A charge that needs buyer authentication fails with last_payment_error.code: authentication_required. Update the subscription's payment method before trying again; this off-session retry has no authentication step to complete.
  • Each retry sends subscription_payment_retry.created, then subscription_payment_retry.succeeded or subscription_payment_retry.failed. A failed manual retry sends subscription.updated only if it changes next_retry_at, such as clearing it after a permanent decline.
  • A failed manual retry doesn't use up an automatic retry or move the next one.
  • Replaying the key returns the same retry and never charges again, even after the subscription has left past_due.
  • The subscription must be past_due (otherwise reason unsupported_state), with no delivery hold (reason delivery_hold: fix delivery instead, and the renewal is charged when the hold clears) and not waiting on stock (reason inventory_wait; see Renewals that need attention).
  • Because it charges a card, this call counts in the external_provider_action rate limit class.

Buyers can start their own retries with POST /v1/me/subscriptions/{subscription_id}/payment-retries, up to 3 per billing period, counting retries you start. Your own retries are not limited. While the subscription is past_due, the retry_payment buyer action carries retry_payment.remaining_retries and max_retries even when unavailable. Zero left reports limit_reached. A pending or processing retry takes precedence with in_progress and retry_payment.active_subscription_payment_retry_id; read it through GET /v1/me/subscriptions/{subscription_id}/payment-retries/{subscription_payment_retry_id} until it finishes. The count starts again when a later billing period becomes past due. A buyer who scheduled a cancellation has to undo it first: until then, their retry returns 409 ACTION_NOT_ALLOWED, reason cancellation_scheduled, and their retry_payment action reads unavailable_reason: "not_in_state".

Resume doesn't recover a past-due subscription. It returns 409 ACTION_NOT_ALLOWED, reason payment_required, because there's an unpaid cycle to collect.

Failed renewal payments and dunning covers the whole recovery path in one place, including retry schedules for other windows and a test clock walkthrough.

Free trials#

Set trial_period_days on the plan, and every subscriber starts trialing:

  • Provision access at signup. A card saved at signup is checked up front, which lets the trial convert on its own. A trial with nothing to charge at creation can also start without a card.
  • trial_end_at and next_billing_at mark when it converts. Unless you set billing_anchor_day, renewals bill on the trial end's day of the month.

During the trial, current_period_start_at and current_period_end_at describe the first paid period, which starts at trial_end_at. The trial has no period of its own.

When the trial ends, Flint charges the first period and the subscription stays trialing while the charge is pending. A subscription becomes active only after that charge succeeds, which sends subscription.payment_succeeded and subscription.activated. A declined charge moves the subscription straight from trialing to past_due and follows the failed payment path. When a retry succeeds, the subscription becomes active and Flint sends subscription.activated exactly once, because activation waits for a successful payment.

Canceling during a trial schedules the cancellation for trial_end_at: the subscription stays trialing with cancel_at_period_end: true, and the buyer is never charged. Send cancel_immediately: true to end the trial now.

Plans with physical lines can't have a trial, because it would ship goods before any payment (400 INVALID_REQUEST, detail code NOT_ALLOWED). Use a first-shipment offer instead.

Discounts and first-shipment offers#

Discount subscription charges with a promotion applied at signup or attached later. Its application_method.recurrence decides which charged cycles it covers, starting at its first_cycle:

recurrence.typeDiscounts
onceOne charged cycle, starting at first_cycle.
repeatingperiod_count charged cycles, starting at first_cycle.
foreverEvery charged cycle from first_cycle. Use it for subscribe-and-save.

A promotion without recurrence works like once; when you send recurrence, its type is required. Flint counts charged cycles, the same numbers as subscription_cycle, so a skipped or held cycle doesn't use up a discounted one. On a plan that ships, a promotion that takes 100% off the items still leaves the shipping charge, so "first box free, pay shipping" works.

For a $15.00 monthly plan with a $0.99 first month, create an amount_off promotion for 1401 USD cents with application_method.recurrence: {"type": "once"}. Apply it when creating the signup checkout:

Response
{
  "type": "subscription_plan",
  "subscription_plan_id": "plan_1kmn0aExample",
  "discounts": [{"promotion": {"promotion_id": "promo_1kmn0aExample"}}],
  "promotion_config": {"codes_enabled": false}
}

With no trial, setup fee, or tax, the signup order is $0.99 and the next month is $15.00. The signup consumes the once promotion. With a free trial, the offer appears in order.deferred_promotions; the first charge after the trial is $0.99, then later months are $15.00. A by-ID offer uses no code and carries promotion_code_id: null on the subscription while it has discounted cycles remaining. Account promotion settings still apply. See Apply a promotion when you create a checkout session.

The subscription's promotions lists the promotions eligible to discount its next charged cycle, completed_cycles + 1. Attachments that start later appear in scheduled_promotions. Both arrays are always present and are [] when empty:

JSON
{
  "promotions": [
    {
      "promotion_id": "promo_1kmn0aExample",
      "promotion_code_id": "pcode_1kmn0aExample",
      "name": "10% off for 3 months",
      "first_cycle": 1,
      "recurrence": {"type": "repeating", "period_count": 3},
      "remaining_cycles": 2
    }
  ],
  "scheduled_promotions": []
}
  • name is the customer-facing name the promotion had when attached.
  • first_cycle is the first charged cycle eligible for the promotion. Later attachments appear in scheduled_promotions until their start cycle. A replacement limits the old promotion to cycles before the new promotion's first_cycle.
  • remaining_cycles counts the paid cycles the promotion can still discount. Skips, failed payments, and paid cycles without the discount use none of its allowance. It's null for forever unless a replacement limits it. When historical records are incomplete, Flint may report fewer remaining cycles than the unused allowance. If no reliable bound is available, Flint treats the allowance as used up.
  • promotion_code_id is the code used to attach the promotion, at checkout or in the apply request, or null when none was used.
  • A once or repeating promotion leaves when its cycles are used. A once promotion on a free trial is listed until the first charge after the trial uses it; on an ordinary signup it is used by the signup order, so it never appears. The array is [] when nothing applies.

It shows terms, not amounts. Past discounts are in each renewal order's discounts, and the next-charge preview shows what each promotion takes off the next charge.

Discount a subscription#

Attach a promotion to an existing subscription by code or ID. The apply and remove routes require commerce.subscriptions.write and return 200 with the updated subscription. Idempotency-Key is optional: a retry with the same key and body returns the original result. Without a key, a repeated apply returns 409 and never attaches the promotion twice: PROMOTION_DECLINED with reason: already_applied, or VERSION_CONFLICT when the body sends expected_version.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/promotions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: subscription-retention-001" \
  -d '{"promotion":{"promotion_code":"RETENTION20"},"expected_version":7}'

first_cycle defaults to completed_cycles + 1. While past_due, it defaults to completed_cycles + 2, because the unpaid renewal order keeps its price. These defaults are also the minimum; the maximum is completed_cycles + 120. A future start appears in scheduled_promotions. Paid orders and an existing unpaid renewal order keep their discounts.

To replace an active or scheduled promotion, add replace_promotion_id to the apply body. The old promotion stops applying from first_cycle and continues on earlier cycles. It must differ from the new promotion. At most 5 promotions can be attached, including scheduled promotions.

Remove active or scheduled promotions by their IDs:

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/promotions/remove \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: subscription-remove-promotion-001" \
  -d '{"promotion_ids":["promo_1kmn0aExample"],"expected_version":8}'

Send 1 to 5 unique IDs. Removal affects future renewal orders and has no timing option. Removing a promotion preserves its consumed cycles and does not return a use. First attachment counts one use; renewals and reattachment do not count another. Reattachment freezes the promotion's current terms and keeps the cycles already consumed. Reattaching a removed promotion whose discounted cycles are all used returns 409 PROMOTION_DECLINED with reason: recurrence_completed; choose a different promotion. While a renewal is being collected, both routes return 409 OPERATION_IN_PROGRESS; retry after Retry-After.

Apply and remove work while scheduled, trialing, active, past_due, or paused, including with cancellation scheduled. They return 409 ACTION_NOT_ALLOWED for canceled or incomplete subscriptions, or when removing or replacing an offer's own promotion. A promotion not attached to this subscription returns 404 at replace_promotion_id or promotion_ids[i]. Send expected_version from the subscription you read to guard either mutation; a stale version returns 409 VERSION_CONFLICT. Each successful change advances the subscription's version and emits subscription.updated.

Preview a promotion#

Before applying a promotion, send mode: "promotion_apply" to POST /v1/subscription-previews. This merchant API request requires commerce.subscriptions.read and no Idempotency-Key.

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-previews \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"promotion_apply","subscription_id":"sub_01ARZ3NDEKTSV4RRFFQ69G5FAV","promotion":{"promotion_code":"RETENTION20"},"first_cycle":3}'

subscription_id and promotion are required. Identify the promotion by exactly one of promotion_id or promotion_code. The optional first_cycle and replace_promotion_id use the same rules as apply. Omit first_cycle to preview the next cycle without a renewal order.

The 200 response's data contains mode, subscription_id, promotion, and renewal. promotion shows the proposed attachment, including first_cycle, its recurrence, and remaining discounted cycles. renewal.subscription_cycle equals that first_cycle. renewal.billing_at is projected from Flint's schedule. It is null for an external schedule, when a cancellation is scheduled before that cycle, when end_after ends the subscription before that cycle is charged, or while the subscription is paused with no resume date.

The preview uses the same eligibility checks as apply and saves no attachment or promotion use. A refusal returns an HTTP error, such as 409 PROMOTION_DECLINED, rather than an entry in errors. Eligibility and estimates can change before you apply the promotion.

Show the next charge#

POST /v1/subscription-previews with mode: "next_renewal" estimates the subscription's next charge without changing anything. Buyers call POST /v1/me/subscription-previews with a customer session for their own subscriptions, so you can show the amount on your account pages.

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-previews \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"mode": "next_renewal", "subscription_id": "sub_1kmn0aExample"}'
Response
{
  "data": {
    "mode": "next_renewal",
    "subscription_id": "sub_1kmn0aExample",
    "renewal": {
      "billing_at": "2026-11-13T00:00:00Z",
      "subscription_cycle": 5,
      "currency": "USD",
      "line_items": [
        {
          "subscription_line_item_id": "sli_1kmn0aExample",
          "name": "Pro Plan",
          "quantity": 1,
          "subtotal_money": {"amount": 4900, "currency": "USD"},
          "discount_money": {"amount": 490, "currency": "USD"}
        }
      ],
      "discounts": [
        {
          "source": "promotion",
          "promotion_id": "promo_1kmn0aExample",
          "name": "10% off every renewal",
          "discount_money": {"amount": 490, "currency": "USD"}
        }
      ],
      "subtotal_money": {"amount": 4900, "currency": "USD"},
      "discount_money": {"amount": 490, "currency": "USD"},
      "tax_money": {"amount": 364, "currency": "USD"},
      "shipping_money": null,
      "total_money": {"amount": 4774, "currency": "USD"}
    }
  },
  "request_id": "req_..."
}
  • For prepaid subscriptions, delivery_interval, delivery_interval_count, and deliveries_per_period describe the deliveries that charge buys. The renewal preview's billing_at shows the shifted charge date while paused with a resume time, and is null for an indefinite pause.
  • billing_at is when Flint plans the charge: next_billing_at, or next_retry_at, starts_at, or scheduled_resume_at in those states. It's null when no charge is planned: paused with no end date, an external schedule waiting for a date, set to cancel, or in the final cycle of an end_after.
  • subscription_cycle is the number the charge would carry, completed_cycles plus one.
  • line_items[].quantity is the line's own quantity.
  • shipping_money is null for a subscription that doesn't ship. tax_money is null when Flint can't calculate tax yet, such as with no address to tax.

Tax and shipping are estimates: Flint quotes shipping again when the renewal charges, so the final amounts can differ. The preview doesn't check or reserve stock. A canceled subscription returns 409 ACTION_NOT_ALLOWED, reason terminal_status. Delivery that can't be quoted returns the delivery errors, and a tax service outage returns 502 EXTERNAL_SERVICE_ERROR.

Manage the lifecycle#

Subscription responses list the actions the subscription's state allows in supported_actions:

ActionRouteWhat it does
cancelPOST /v1/subscriptions/{subscription_id}/cancelEnds the subscription now or at the end of its period. See Cancel.
pausePOST /v1/subscriptions/{subscription_id}/pauseSuspends billing. See Pause and resume.
resumePOST /v1/subscriptions/{subscription_id}/resumeRestarts billing for a paused subscription.
skip_cyclePOST /v1/subscriptions/{subscription_id}/skip-cycleSkips the next renewal. See Skip a renewal.
renewPOST /v1/subscriptions/{subscription_id}/renewBills the next renewal now. See Order now.
change_planPOST /v1/subscriptions/{subscription_id}/change-planMoves a plan subscription to another plan. See Change a subscriber's plan.
JSON
{
  "subscription_id": "sub_1kmn0aExample",
  "status": "active",
  "cancel_at_period_end": false,
  "supported_actions": ["cancel", "pause", "skip_cycle", "renew", "change_plan"]
}

Show a control only when its action is listed, and ignore values you don't recognize: Flint can add actions. The list follows the subscription's stored state, so a listed action can still be refused for a passing reason, such as Order now while a renewal payment is in progress. Handle each route's response even when the action is listed. Undoing a scheduled cancellation isn't an action; it's an update. Buyer reads omit supported_actions and carry buyer_actions instead, which also apply the store's buyer settings.

Concurrency. Pause, resume, cancel, Order now, plan changes, and every PATCH /v1/subscriptions/{subscription_id} accept an optional expected_version. Versions and write fences covers 409 VERSION_CONFLICT and 409 CONCURRENT_MODIFICATION.

When a subscription refuses an action#

When the subscription's status or schedule doesn't allow an action, Flint returns 409 ACTION_NOT_ALLOWED and changes nothing, whether the request came with your API key or from a buyer's customer session. Branch on code, then on details[0].reason, as Error handling describes.

details[0] names the subscription in resource_type and resource_id, with its current_status and, when known, current_version. param appears only when one request field caused the refusal. A refusal of your own request also carries details[0].supported_actions, which can be empty. remediation.retry is none: the same request fails until the subscription changes.

ActionreasonThe state that refusesWhat to do
Quantity change, line create, delete or quantity change, plan change with now or next_renewal, renew, a billing_interval PATCH, previews of these, and a buyer's immediate cancel.prepaid_deliveries_remainingPaid deliveries remain; immediate buyer cancel is refused when period end is available.Wait until Flint has created every paid delivery order, use period_end for a plan change, or cancel at period end. See Prepaid deliveries.
Any changeterminal_statuscanceled.Create a new subscription if the buyer still wants one.
Interval, count, or anchor changefirst_period_unpaidCreated with prorate_first_period: true, before its first payment is paid.Wait for the first payment; changes that keep these calendar terms are allowed.
Pausecancellation_scheduledactive, set to cancel at period end.Reactivate it, then pause.
Pauseunsupported_statetrialing, past_due, scheduled, or incomplete.Pause once it's active.
Pausefield_locked, param pause_duration_cyclespaused with a different length.Resume it, then pause with the new length.
Resumepayment_requiredpast_due, including a first period never paid.Update the card and retry the payment, or cancel.
Resumecancellation_scheduledactive or trialing, set to cancel.Reactivate it instead.
Resumenot_pausedAny other status that isn't paused.Nothing to resume.
Cancel at period endperiod_end_unavailablescheduled, incomplete, paused, or past_due without next_retry_at.Send cancel_immediately: true.
Order now or a now plan changeunsupported_state, cancellation_scheduled, trial_in_progress, external_billing_schedule, delivery_hold, in_progress, or end_after_reachedSee Order now.Follow that list.
A prorated_now plan change or quantity change billed nowcredit_exceeds_charge, minimum_charge, paid_period_required, in_progress, unsupported_state, trial_in_progress, external_billing_schedule, plan_change_scheduled, or already_appliedSee Prorated charges.Follow that list.
Schedule changeunsupported_statepast_due or incomplete.Change it once the subscription is active.
Skipunsupported_stateNot active, set to cancel, or with no next_billing_at.Skip once it's active; reactivate one set to cancel.
Skip, by a buyerexternal_billing_schedulebilling_schedule_owner is external.Skip it for them with your API key.
Payment retrydelivery_holdpast_due with a delivery_hold.Fix delivery; Flint charges when the hold clears.
Payment retryinventory_waitThe renewal is waiting on stock.Wait for stock, or change the items.
Payment retryunsupported_stateAny status except past_due.Retries are for past_due subscriptions.

Flint can add reasons. For one you don't recognize, read the subscription and choose an action its status allows.

Pause and resume#

Pausing suspends billing without ending the relationship: a seasonal business, a hardship hold, or a break the buyer asks for.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/pause \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"pause_duration_cycles": 2}'

pause_duration_cycles (1 or more) pauses for that many billing cycles, or delivery intervals on a prepaid subscription, and scheduled_resume_at says when it resumes on its own. Omit it to pause until you resume; scheduled_resume_at is then null. Only active subscriptions pause. Pausing again with the same length, or again without one, returns the subscription unchanged.

A pause doesn't use up cycles either. With an end_after in the cycles form, the subscription keeps its remaining cycles and ends later by the length of the pause. A date end doesn't move. While a subscription is paused without a resume time, a cycles end with cycles still left has no expires_at yet, because no charge is scheduled, and remaining_cycles still counts the cycles left. A date end, a reached cycle limit, and a known scheduled cancellation keep their expires_at, as End automatically explains.

pause_reason says why a subscription is paused: merchant for your pause, buyer for the buyer's own, payment_failed when retries ran out under a pause policy, and delivery_action_required for a pause during or after a delivery hold.

For a buyer's own pause, read the pause entry in buyer_actions and offer it only when is_available is true. When pause.max_pause_duration_cycles is present, send a pause_duration_cycles from 1 to that limit; when it's absent, omit the length. The store's customer_account.buyer_capabilities.pause sets these options, and a buyer's pause after the store turns pausing off returns ACTION_NOT_ALLOWED, reason not_offered. Your own pauses aren't limited by the buyer settings.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/resume \
  -H "Authorization: Bearer YOUR_API_KEY"

Resume works only on a paused subscription, and it's asynchronous. Flint accepts it with 202 Accepted and Retry-After: 2: the subscription is still paused, resume_requested_at is set, and Flint sends subscription.updated. The body can be empty, {}, or {"expected_version": 4}. Then one of two things happens, and resume_requested_at clears either way:

  • Resumed. The status becomes active, or past_due while an overdue period is collected, and Flint sends subscription.resumed.
  • Refused. Delivery can't be quoted for a delivery_action_required pause. The subscription stays paused, and Flint sends subscription.updated.

Resuming a prepaid subscription that still owes deliveries makes no charge. Remaining deliveries and the next charge shift by the length of the pause.

Grant paid access again only when the subscription is active.

Pause, skip, and resume subscriptions works through resume dates with examples, and the buyer pause and skip limits.

On a flint schedule, resuming keeps the time the buyer already paid for: next_billing_at moves later by the length of the pause, billing_anchor_day moves with it, and renewals stay a full interval apart. If a payment is overdue or no paid time remains, Flint collects the unpaid period before the subscription is active again. A collection more than 24 hours after that period's billing date starts a new period on the payment day. An external schedule keeps the dates you set.

Cancel#

For prepaid subscriptions, period-end cancellation waits for the later of the period boundary and the last paid delivery. A merchant can cancel immediately and refund undelivered deliveries manually. A buyer's immediate cancellation is refused with prepaid_deliveries_remaining while paid deliveries remain and period end is available; a paused subscription can still be canceled now.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/cancel \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{}'

By default, cancel waits for the next time Flint would charge the subscription, and that charge doesn't happen. cancel_at_period_end becomes true, scheduled_cancel_at says when the cancellation takes effect, and Flint sends subscription.cancellation_scheduled. At that time the subscription becomes canceled and Flint sends subscription.canceled. Send {"cancel_immediately": true} to end it now, from any status.

StatusA default cancel
trialingTakes effect at trial_end_at. The buyer is never charged.
activeTakes effect at current_period_end_at, so the buyer keeps the time they paid for. If a renewal waiting for delivery or stock has reached that date, it ends now.
past_due with inventory_wait at or after current_period_end_atEnds now.
past_due with next_retry_atTakes effect at next_retry_at, in place of that retry.
past_due without next_retry_at, scheduled, incomplete, or pausedFails with 409 ACTION_NOT_ALLOWED, reason period_end_unavailable. Send cancel_immediately: true.

On the merchant cancel route, optional initiated_by is buyer, merchant (the default), or integration. Omit the body to use the defaults. This field records attribution in cancellation_details.requested_by and cancellation_reason; it does not apply the store's buyer limits. To enforce them, use a customer session on POST /v1/me/subscriptions/{subscription_id}/cancel. That route always records buyer and does not accept initiated_by.

Asking again for a cancellation that's already scheduled returns it unchanged and keeps the first request's details. Canceling a canceled subscription returns it.

To undo a scheduled cancellation before scheduled_cancel_at, update the subscription:

cURL
curl -X PATCH https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"cancel_at_period_end": false}'

Flint sends subscription.reactivated, and the subscription renews as usual. Sending false with no cancellation scheduled returns the subscription unchanged and sends nothing. PATCH doesn't accept true: schedule a cancellation with the cancel route. A buyer undoes their own cancellation with PATCH /v1/me/subscriptions/{subscription_id} when their reactivate action is available.

On a plan that ships, canceling never cancels a renewal order that's already paid: that shipment still goes out, and the cancellation email tells the buyer. To stop it, refund and cancel that order. When the subscription becomes canceled, Flint clears its delivery; past orders keep their own destinations.

A buyer can always cancel their own subscription. The cancel entry in buyer_actions gives the options available now: cancel.timing is end_of_period (omit cancel_immediately), immediately (send cancel_immediately: true), or buyer_chooses (offer both). The store's customer_account.buyer_capabilities.cancellation_timing and the subscription's state decide it, and sending true when the timing is end_of_period returns ACTION_NOT_ALLOWED, reason not_offered. Offer reasons from cancel.cancellation_reasons, and a pause instead only when cancel.retention_offer is present.

Payments still processing#

Canceling immediately ends the subscription even while a payment is processing. If the setup fee or a recurring payment completes at or after canceled_at, Flint refunds the full remaining refundable amount to the original payment method. Payments completed before the cancellation stay owed. If any fulfillment on that order has started and wasn't canceled, Flint doesn't refund, and the shipment still goes out.

If you cancel at period end while a renewal payment is processing, Flint waits for it. If it succeeds, the subscription stays active through the renewed period and then cancels, with no refund. If it fails, Flint cancels right away without retrying.

An automatic refund sends refund.created, then refund.succeeded, refund.partially_succeeded, or refund.failed, and the buyer gets the standard refund receipt unless customer_email_delivery.order_receipts is merchant_sends. The refund has reason: "other" and metadata source: "subscription_canceled_before_payment" and subscription_id.

Record why#

Send the reason with the cancellation:

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/cancel \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"initiated_by": "buyer", "cancellation_reason_code": "too_expensive", "cancellation_comment": "Found a cheaper plan"}'

cancellation_reason_code is too_expensive, missing_features, switched_service, unused, customer_service, too_complex, low_quality, or other. Both fields are optional, and cancellation_comment holds up to 500 characters. A buyer's code must be one of the store's cancellation_reasons (400 INVALID_REQUEST otherwise).

The subscription then carries cancellation_details: reason_code, comment, requested_by (buyer, merchant, or integration), and requested_at. comment is never sent to buyers or in subscription.cancellation_scheduled. Undoing the cancellation removes the details.

To tell voluntary churn from involuntary churn, read cancellation_reason in subscription.cancellation_scheduled and subscription.canceled: buyer, merchant, or integration when that party asked, payment_failed for a subscription canceled with no request, such as when retries ran out or a trial without a card reached its first charge, other for a scheduled cancellation with no recorded requester, and end_after_reached for a subscription that ended on its end_after. Treat cancellation_reason as extensible: it can gain values.

Collect an early termination fee#

When the plan had a contract, the subscription records contract_start_at, contract_end_at, and early_termination_fee_money for its whole life, through plan changes and pauses. Flint shows these terms at checkout but doesn't stop a buyer from canceling early, and never charges the fee. To decide whether the buyer owes it, compare canceled_at (or scheduled_cancel_at) with contract_end_at.

To collect it, create an order for the fee for the subscription's customer and pay it with their saved card and customer_presence: "absent", as When the customer is not there shows. It's an ordinary order payment that you can refund like any other.

End automatically#

end_after ends a subscription without a cancel request: a six-month plan, a fixed-term membership, a season pass. Without it, a subscription renews until someone cancels it. A plan's contract term stays advisory and never ends a subscription.

end_after is null or one of two forms, picked by type:

typeFieldsThe subscription ends
cyclescycle_count, 1 to 1,200When completed_cycles reaches cycle_count, at the end of that period.
dateend_date (YYYY-MM-DD), optional timezone (an IANA name)At the last billing boundary on or before end_date, in that timezone. Flint never charges a period that would cross it.

A date end that falls inside a period ends the subscription at the last billing boundary before it. A monthly subscription that renews on the 15th with end_date 2027-06-30 is charged for the period from May 15 to June 15, doesn't start the one that would run to July 15, and ends on June 15.

Only time the buyer has already paid for runs past the close of end_date. A period that is already paid and crosses the date runs to its end. A period that needs a new charge and would cross the date is refused, and the subscription ends where that period would have started. A trial, or a period that isn't paid yet, that crosses the date ends at the close of end_date. Flint never extends a trial past the date. A skipped period creates no paid time, so one that crosses the date also ends at the close of end_date. For example, with a trial that ends January 15 and an end_date of January 31, the first monthly period would run to February 15. Flint doesn't charge it, and the subscription ends on January 15.

The timezone for a date end comes from the request, then your merchant's reporting_timezone, then UTC. Flint stores the one it used with end_after, so changing reporting_timezone later doesn't move the end.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: sub-ada-term-001" \
  -d '{
    "terms": {
      "type": "subscription_plan",
      "subscription_plan_id": "plan_1kmn0aExample"
    },
    "customer_id": "cus_1kmn0aExample",
    "billing_start": {"type": "immediate"},
    "end_after": {"type": "cycles", "cycle_count": 3}
  }'

The subscription reports end_after as you set it, plus two fields Flint computes:

  • remaining_cycles. How many charges are left before the subscription ends. An earlier scheduled cancellation limits it.
  • expires_at. When the subscription ends, worked out the same way Flint ends it. An earlier cancellation at the end of the period moves it earlier, and a change to the subscription's cadence that Flint has already committed to applies. It's null only when Flint can't determine the end, or when the subscription is canceled.

When no charge is scheduled, because the billing schedule is external with no date or the subscription is paused with no resume time, the two forms differ:

  • A date end still has an expires_at: the later of the close of end_date and the end of time the buyer has already paid for. The engine and the API use the same date.
  • A cycles end with cycles still left has no automatic end until a charge is scheduled, so expires_at is null while remaining_cycles counts the cycles left.
  • A cycles end whose limit is already reached (remaining_cycles is 0) still ends at the end of the last paid period, and expires_at reports that time.
  • A cancellation you scheduled with a known date still takes effect on that date, and expires_at reports it.

Paid deliveries extend the end to the last paid delivery when it falls after the ending boundary. Skips, holds, and pauses can move that delivery later without another charge. An indefinite pause with paid deliveries owed makes expires_at null until the last delivery date is known, including for a date limit or a reached cycle limit.

On a canceled subscription, both fields are null.

Set it when you create the subscription. Omit end_after to take the plan's default, which is a cycles end or none. Send null for a subscription with no end, whatever the plan says. An import takes end_after the same way.

Change it later. Send end_after in PATCH /v1/subscriptions/{subscription_id} with expected_version, which is required whenever the request includes end_after. Flint replaces the whole value, and null clears it. Buyers can read end_after but not change it.

cURL
curl -X PATCH https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: end-sub-ada-001" \
  -d '{
    "end_after": {"type": "date", "end_date": "2027-06-30", "timezone": "America/New_York"},
    "expected_version": 5
  }'

Flint refuses an end that is already behind the subscription with 400 INVALID_REQUEST, detail code INVALID_VALUE: a cycle_count below completed_cycles, or an end_date before the date of current_period_end_at.

Pause and skip. Neither uses up a cycle. A cycles end moves later by the paused or skipped time. A date end stays put. See Skip a renewal and Pause and resume.

Paid time is never cut short. An end_after stops new charges. It never refunds a payment or cancels something already paid for, and the buyer keeps the period they paid for.

Prepaid deliveries. This applies only to a subscription that has paid in advance for several deliveries. An end_after stops new charges, not deliveries that are already paid for. Those deliveries still go out without a new charge, and a skip, a delivery hold, or a timed pause can move them past a date end or past the original paid period. A skip defers one delivery and uses up none of the paid deliveries. A hold or a timed pause uses up none either. The subscription ends automatically at the later of the end_after boundary and the last paid delivery, and it stays active without new charge cycles until then. subscription.end_upcoming uses that later date. If the subscription is paused with no resume time while paid deliveries are still owed, the date of the last delivery isn't known. Flint doesn't cancel the paid deliveries, expires_at is null, and the automatic end waits until the pause lifts and the date is known. A date end still stops new charges.

The last cycle.

  • At the point where Flint would send subscription.renewal_upcoming, it sends subscription.end_upcoming and an ending email to the buyer instead.
  • POST /v1/subscriptions/{subscription_id}/renew and a now plan change return 409 ACTION_NOT_ALLOWED, reason end_after_reached. The subscription has no later renewal to bring forward.
  • The next-charge preview reports billing_at: null.

The end. The subscription becomes canceled with cancellation_reason: "end_after_reached", and Flint sends subscription.canceled. cancellation_details is null, because nobody requested it, and a scheduled plan change is dropped. Revoke access on subscription.canceled, as for any cancellation. To keep a buyer after the end, create a new subscription.

Update#

PATCH /v1/subscriptions/{subscription_id} changes the fields you can edit on a subscription:

FieldWhat it changes
metadata, external_reference_idYour references. metadata merges by key.
payment_method_idThe card renewals charge: an active card of the same customer. See Recover with a new card.
cancel_at_period_endOnly false, to undo a scheduled cancellation. See Cancel.
end_afterWhen the subscription ends on its own, or null for no end. Requires expected_version. See End automatically.
taxThe tax its orders use, or null to follow your settings. See Tax on subscriptions.
platform_fee_ruleA partner app's platform fee rule, replaced whole, or null to remove it. Partner app tokens only. Requires expected_version. See Charge a platform fee.
deliveryWhere shipments go. See Change the delivery preference.
billing_interval with billing_interval_countThe cadence, from what the plan offers, from the next unpaid renewal and with no charge now. Quantities change through change-quantity: see Bill a quantity change now and Change cadence, quantity, and items.
billing_scheduleWho sets dates, and the next date. Send it alone. See Control the billing schedule.

Every field except billing_schedule can go in one request, which applies all of its changes or none. Item prices are fixed by the snapshot: to change them, change the plan. Add, swap, and remove lines through the subscription's line items.

Change cadence, quantity, and items#

A subscription can change after signup within what its plan offers. PATCH and the line-item routes charge nothing. Each change raises version and applies to the next renewal that isn't paid yet; a renewal that's already paid ships as it was. A change made during a delivery hold is checked again at once. To charge for added seats or items now, without moving the billing date, bill the quantity change now.

  • Cadence. Send billing_interval and billing_interval_count together with PATCH /v1/subscriptions/{subscription_id}. The pair must be in the plan's billing_interval_options. next_billing_at stays the same, and the new interval applies from then on. To move the date, use the billing schedule or Order now.
  • Quantity. Send line_items to change-quantity, naming each existing subscription_line_item_id and its new quantity. Use next_renewal to change quantities now without charging or period_end to schedule them. Buyers use period_end or prorated_now on the frozen adjustable line. Scalar PATCH quantity is no longer accepted.
  • Items. Lines are a collection under the subscription:
cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/line-items \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: add-line-ada-001" \
  -d '{"type": "variant", "variant_id": "var_1kmn0bExample", "quantity": 1}'

A new line needs type (400 INVALID_REQUEST, param type), and the other type's ID, such as bundle_id on a variant line, fails with detail code NOT_ALLOWED. A line added or changed to a new variant takes that variant's current catalog price, which then stays fixed. On a subscription that ships, Flint checks new lines against the stored delivery method with the same rules as a plan's physical lines.

To let buyers swap variants themselves, list them on the plan line as swap_variant_ids: up to 25 other variants of the same product, not including the line's own. Only variant lines can list swaps, and [] means none.

Bill a quantity change now#

POST /v1/subscriptions/{subscription_id}/change-quantity changes seats or line quantities. With billing_starts: "prorated_now", it charges the prorated difference at once. The current period, next_billing_at, billing_anchor_day, and completed_cycles don't change, and the lines, prices, and plan stay as they are. Send an Idempotency-Key, and a new key for each change you mean: a second key is a second change that charges again.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/change-quantity \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: change-quantity-sub-ada-001" \
  -d '{
    "billing_starts": "prorated_now",
    "line_items": [{"subscription_line_item_id": "sli_1kmn0aExample", "quantity": 10}]
  }'

This request raises a subscription from 5 seats to 10 at $10 a seat on September 16, the middle of a 30-day period that started September 1. The subscriber already paid $50.00 for the period, and the response charges $25.00 before tax:

Response
{
  "data": {
    "billing_starts": "prorated_now",
    "subscription": {
      "subscription_id": "sub_1kmn0aExample",
      "status": "active",
      "line_items": [{"subscription_line_item_id": "sli_1kmn0aExample", "quantity": 10}],
      "recurring_subtotal_money": {"amount": 10000, "currency": "USD"},
      "current_period_start_at": "2026-09-01T00:00:00Z",
      "current_period_end_at": "2026-10-01T00:00:00Z",
      "next_billing_at": "2026-10-01T00:00:00Z",
      "completed_cycles": 4
    },
    "order": {
      "order_id": "ord_1kmn0bExample",
      "subscription_cycle": 4,
      "discounts": [
        {
          "customer_facing_name": "Elapsed time in current period",
          "source": "proration",
          "applied_money": {"amount": 5000, "currency": "USD"}
        },
        {
          "customer_facing_name": "Unused time on Pro Plan",
          "source": "plan_change_credit",
          "applied_money": {"amount": 2500, "currency": "USD"}
        }
      ],
      "pricing_amounts": {
        "subtotal_money": {"amount": 10000, "currency": "USD"},
        "discount_money": {"amount": 7500, "currency": "USD"},
        "total_money": {"amount": 2500, "currency": "USD"}
      }
    },
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0bExample",
      "status": "succeeded"
    }
  },
  "request_id": "req_..."
}
FieldDescription
billing_startsRequired. prorated_now charges the difference now. next_renewal changes quantities immediately without charging. period_end schedules quantities for the next billing boundary.
line_itemsRequired new line quantities: [{"subscription_line_item_id": "sli_...", "quantity": 3}]. One to 50 distinct IDs of the subscription's lines, each quantity from 1 to 9,999.
expected_versionOptional. The version you read.

Send a nonempty line_items array, or the request fails with 400 INVALID_REQUEST, detail code REQUIRED, param line_items. Use next_renewal for an immediate uncharged edit or period_end to keep the current quantities until the next billing boundary. Both allow physical lines. For these timings, order and order_payment_attempt are null. A period_end proposal appears in scheduled_plan_change and applies once through the same boundary as a scheduled plan change. Cancel it with PATCH {"scheduled_plan_change": null}. While a proposal is pending, all quantity-change timings refuse with plan_change_scheduled.

The response has billing_starts, the updated subscription, the order, and the order_payment_attempt. It returns 200 even when the payment is declined: read order_payment_attempt.status. succeeded means the new quantities are in place. failed means Flint closed the unpaid order and the subscription is exactly as it was; update the card, then send the change again with a new Idempotency-Key. When the net charge is 0, order and order_payment_attempt are null and the quantities still change. Prorated charges explains the amount and the refusals, and a quantity change preview shows the amount first.

A subscription that mixes digital and physical lines can bill a quantity change for its digital lines. With prorated_now, Flint rejects a line_items entry for a line that ships, with 400 INVALID_REQUEST, detail code NOT_ALLOWED. The adjustment order has no delivery, shipping charge, or shipment, and the lines that ship keep their quantities and prices. The charge still counts the subscription's complete recurring terms, including the lines that ship, after the current cycle's promotions. A scheduled cancellation doesn't block the change.

Buyers use POST /v1/me/subscriptions/{subscription_id}/change-quantity with a full customer session and an Idempotency-Key. Send line_items, billing_starts (period_end, or prorated_now for an eligible digital line), and optional expected_version. Only the frozen line with allow_quantity_adjustment: true can change, and its quantity must stay within its frozen min_quantity and max_quantity. Read those fields from the subscription, rather than the current plan. The update_quantity buyer action points at this route and is available only when the frozen policy allows a change. View-only links cannot use it. Before the buyer confirms a quantity change, show the estimated charge with a buyer quantity preview.

To bill a cadence change now, or to replace the lines with the plan's current lines and prices, change the plan to the subscription's own plan. With billing_starts: "now" that starts a new period and moves the billing date. Paired lines keep their quantities; lines you added or swapped can be dropped. Send line_items to choose the target quantities explicitly.

Order now#

POST /v1/subscriptions/{subscription_id}/renew bills the next renewal now, and ships it when the subscription has delivery. Send an Idempotency-Key, and optionally expected_version. Buyers use POST /v1/me/subscriptions/{subscription_id}/renew. Skip-cycle, pause, cancel, and renew accept an empty body on both the merchant and buyer routes. Omitting the body uses the same defaults as {}.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/renew \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: renew-sub-ada-001" \
  -d '{"expected_version": 9}'
Response
{
  "data": {
    "subscription": {"subscription_id": "sub_1kmn0aExample", "status": "active"},
    "order": {"order_id": "ord_1kmn0aExample", "status": "closed"},
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0aExample",
      "status": "failed",
      "last_payment_error": {
        "code": "insufficient_funds",
        "message": "The payment method has insufficient funds. Ask the customer to use a different payment method.",
        "failed_at": "2026-10-17T15:04:05Z",
        "remediation": {"retry": "none"}
      }
    }
  },
  "request_id": "req_..."
}

Flint runs a normal renewal at once and returns 200 with the subscription, the renewal order, and its order_payment_attempt. Read the outcome from order_payment_attempt.status, not the HTTP status:

  • succeeded. For a subscription without delivery, Flint credits any unused paid item time against the renewal. A new period starts now, next_billing_at becomes now plus one interval, completed_cycles goes up, and the order gets the next subscription_cycle. Consecutive skips reset.
  • failed. As in the example, the charge was declined, blocked, or failed authentication, and last_payment_error says why. Flint closes the unpaid order without starting a new paid period or dunning, and the subscription renews on its usual date. A pending plan change applied before the charge stays applied. Update the card, then order again with a new Idempotency-Key. The same key returns the same result and never charges again.

Order now applies any pending plan change before charging this early renewal.

The subscription must be active on a flint schedule. Flint checks these in order and refuses with the first that applies, as 409 ACTION_NOT_ALLOWED with remediation.retry: none:

reasonMeaning
terminal_statusThe subscription is canceled.
unsupported_stateAnother status that isn't active.
cancellation_scheduledIt's set to cancel at period end. Reactivate it first, because ordering now would push the cancellation an interval later.
trial_in_progressThe trial hasn't ended.
external_billing_scheduleYour integration owns the billing dates.
delivery_holdThe renewal is held. Fix delivery instead.
in_progressA renewal payment is already running. Wait for it to finish and read the subscription. Don't send Order now again automatically: that would start a second renewal.
end_after_reachedThe subscription is in the final cycle of its end_after, so no renewal is left to bring forward.
credit_exceeds_chargeThe unused-time credit is larger than the renewal price. The scheduled renewal stays on its usual date.
paid_period_requiredFlint can't verify the unused-time credit, for example during a paid period imported from another service. The scheduled renewal stays on its usual date.
minimum_chargeThe charge after credit is below the payment minimum. Try again later or wait for the scheduled renewal.

Treat a reason you don't recognize as not renewable now. Before charging, Flint also checks what the charge needs, and refuses without changing anything:

ErrorWhen
409 ACTION_NOT_ALLOWED, reason configuration_required, resource_type payment_methodThe subscription has no card, or its card isn't active, works only with the buyer present, or belongs to another customer. Update the card first.
409 ACTION_NOT_ALLOWED or 502 EXTERNAL_SERVICE_ERRORDelivery can't be quoted. See When a delivery preference can't ship.
409 INVENTORY_INSUFFICIENTStock can't cover the shipment.
409 MERCHANT_NOT_READYYour account can't take payments right now, for example while it's under review or isn't set up. Retrying doesn't help until readiness changes. Scheduled renewals aren't canceled or failed for this: they wait and retry once payments are back.

A payment provider outage or timeout returns 502 EXTERNAL_SERVICE_ERROR or a 500; retry with the same Idempotency-Key.

Change a subscriber's plan#

POST /v1/subscriptions/{subscription_id}/change-plan moves a subscription to another plan, or to its own plan's current lines and prices. Use it to upgrade, downgrade, or reprice. Your API key can move a subscription to any plan; buyers can change plans only among the plans you list for them. Quantities carry to paired target lines, so upgrading three $10 seats to a $25 seat plan keeps three seats and a $75 recurring subtotal. Send line_items to choose different quantities. Send an Idempotency-Key, and a new key for each change you mean: a second key is a second change, and with billing_starts: "now" or "prorated_now" it charges again.

Subscription plan changes and proration compares the four timings on one upgrade, with downgrade and seat examples.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/change-plan \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: change-plan-sub-ada-001" \
  -d '{
    "subscription_plan_id": "plan_1kmn0bExample",
    "billing_starts": "now"
  }'
Response
{
  "data": {
    "billing_starts": "now",
    "subscription": {
      "subscription_id": "sub_1kmn0aExample",
      "subscription_plan_id": "plan_1kmn0bExample",
      "status": "active",
      "recurring_subtotal_money": {"amount": 4900, "currency": "USD"},
      "current_period_start_at": "2026-10-13T00:00:00Z",
      "current_period_end_at": "2026-11-13T00:00:00Z",
      "next_billing_at": "2026-11-13T00:00:00Z",
      "completed_cycles": 4
    },
    "order": {
      "order_id": "ord_1kmn0aExample",
      "subscription_cycle": 4,
      "discounts": [
        {
          "customer_facing_name": "Unused time on Starter",
          "source": "plan_change_credit",
          "applied_money": {"amount": 1777, "currency": "USD"}
        }
      ],
      "pricing_amounts": {
        "subtotal_money": {"amount": 4900, "currency": "USD"},
        "discount_money": {"amount": 1777, "currency": "USD"},
        "total_money": {"amount": 3123, "currency": "USD"}
      }
    },
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0aExample",
      "status": "succeeded"
    }
  },
  "request_id": "req_..."
}
FieldDescription
subscription_plan_idRequired. The plan to move to, which can be the current one. It must be active: an inactive plan returns 409 ACTION_NOT_ALLOWED, reason unsupported_state, and an archived one reason archived.
billing_startsRequired: now, prorated_now, next_renewal, or period_end.
billing_interval, billing_interval_countOptional, sent together. Omit both to keep the current pair when the target offers it, otherwise use the target plan's own default pair. An explicit pair must be offered by the target. prorated_now needs the resulting interval to stay the same.
line_itemsOptional target quantities: [{"subscription_plan_line_item_id": "spli_...", "quantity": 3}]. IDs must belong to the target plan and cannot repeat. Quantities are whole numbers from 1 to 9,999. Omitted target lines use the pairing rules.
expected_versionOptional. The version you read.

Choose the plan change interval#

Send billing_interval and billing_interval_count together to choose one of the target plan's options. If you omit both, Flint keeps the subscription's current pair when the target offers it. Otherwise, Flint uses the target plan's own billing_interval and billing_interval_count, even if another option appears first in your request.

For example, moving a monthly subscription to a plan that offers only yearly with count 1 selects that yearly interval without extra fields. A target that also offers the subscription's current monthly pair keeps it, even when the target's default is yearly. An explicit pair the target doesn't offer returns 400 INVALID_REQUEST with detail code INVALID_VALUE on billing_interval; the message names the requested pair and every offered pair.

This rule applies to merchant and buyer plan changes and their previews, for every billing_starts value. A period_end change freezes the resolved interval when scheduled. Later edits to the target's defaults or options do not change it.

Choose when the plan changes#

  • next_renewal. The plan and its terms change immediately. Nothing is charged now. The current period stays as paid, with no credit, and next_billing_at doesn't move. The next charge, whether a renewal, a first payment, or a payment retry, bills the new plan, and a new interval applies from next_billing_at. It works in every status except canceled, including trialing, which keeps its trial. The response has the updated subscription, with order and order_payment_attempt set to null.
  • now. Flint starts a new period today on the target plan and charges it at once, less a credit for the unused part of the current period. The charge is a regular renewal order with the next subscription_cycle, next_billing_at becomes now plus the new interval, billing_anchor_day becomes today's UTC day, and the order ships when the subscription has delivery. The subscription moves to the new plan only if the payment succeeds.
  • prorated_now. Flint charges the target plan's items for the rest of the current period, less a credit for what the buyer paid for the unused time, and keeps the period. current_period_start_at, current_period_end_at, next_billing_at, billing_anchor_day, and completed_cycles don't change, and the interval must stay the same. The charge is an order for the current subscription_cycle, not a new renewal, and it ships nothing, so neither the current plan nor the target plan can ship. The subscription moves to the new plan only if the payment succeeds. A successful change clears a pending period_end change. Prorated charges has the formula and an example.
  • period_end. The current plan and paid access stay in effect until the next renewal Flint charges. Flint freezes the target lines, prices, interval, quantity, and other terms when you schedule the change. Nothing is charged or credited now, and order and order_payment_attempt are null. The result's required billing_starts field reports the timing Flint uses.

A price or billing cadence change requested with next_renewal or period_end inside the renewal notice window takes effect on the following charged renewal. The window starts 3 days before most renewals and 30 days before yearly renewals or monthly intervals of 12 months or more. The upcoming charge keeps its existing terms. The change response reports billing_starts: "period_end" and the projected date in scheduled_plan_change.effective_at. An earlier scheduled price change already due at the upcoming renewal can be changed after that renewal.

A now or prorated_now change returns 200. Read the outcome from order_payment_attempt.status: succeeded means the subscription is on the new plan. failed means Flint closed the unpaid order and the subscription is exactly as it was; update the card, then send the change again with a new Idempotency-Key. A prorated_now change whose net charge is 0 returns order and order_payment_attempt as null after applying the plan.

now needs an active subscription on a flint schedule with nothing else charging it, so it's refused for the same reasons as Order now: unsupported_state, cancellation_scheduled, trial_in_progress, external_billing_schedule, delivery_hold, and in_progress. It also checks the card, delivery, and stock the same way. prorated_now has its own refusals, listed under Prorated charges: it ships nothing, so it checks no delivery or stock, and a scheduled cancellation doesn't block it. A next_renewal or period_end change checks neither the card nor stock, because nothing is charged. All four choices are refused, with 409 ACTION_NOT_ALLOWED, when:

reasonMeaning
terminal_statusThe subscription is canceled.
credit_exceeds_chargenow and prorated_now: the unused-time credit is more than the new items cost. Use period_end to keep the paid plan until the next charged renewal.
unsupported_stateperiod_end needs active, trialing, or paused. For past_due, incomplete, or scheduled, use next_renewal. now and prorated_now need active.
cancellation_scheduledA pending cancellation prevents scheduling a period_end change.
delivery_requirement_changesThe plan ships and the subscription doesn't, or the reverse. Moving between physical and digital needs a new subscription.
method_unavailableThe target plan doesn't offer the subscription's delivery method.
offer_subscriptionThe subscription came from a subscription offer, so it has no plan to change.
quantity_not_carriedThe current seat count is outside the target bounds, or an adjusted line has no match. Send the target seat quantity for a bounds refusal, or every target line quantity for an unmatched line. param is line_items, and details[0].blocking_resources identifies subscription lines your key can read. Nothing changes.

If a renewal or another change is in progress, a now or prorated_now plan change returns 409 ACTION_NOT_ALLOWED with reason in_progress. If the subscription changes after Flint accepts the request for processing, the change can return 409 VERSION_CONFLICT. The same Idempotency-Key replays the conflict. Read the subscription after billing finishes and use a new key if you still want to make the change. A next_renewal or period_end change can return 409 OPERATION_IN_PROGRESS with a short Retry-After when billing is in progress.

A target plan in another currency fails with 400 INVALID_REQUEST, detail code NOT_ALLOWED, param subscription_plan_id. A prorated_now change whose resulting interval differs from the current one fails the same way, with param billing_starts; use now or period_end to change the interval.

Schedule or clear a pending change#

Every subscription response includes scheduled_plan_change, set to null when no change is pending. Scheduling period_end advances version and returns the current plan with the frozen target snapshot:

JSON
{"scheduled_plan_change": {
  "subscription_plan_id": "plan_1kmn0cExample",
  "billing_interval": "yearly",
  "billing_interval_count": 1,
  "recurring_subtotal_money": {"amount": 2900, "currency": "USD"},
  "effective_at": "2026-12-01T00:00:00Z",
  "requested_by": "merchant",
  "scheduled_at": "2026-11-16T09:12:00Z"
}}

effective_at is always present and reflects the first eligible charge, which can follow the upcoming renewal when a price change falls inside the notice window. It is null while paused without a scheduled resume or waiting for an external billing schedule. A skip delays the change until a charged renewal; a pause keeps it pending until the first charged renewal after resume. Order now applies it before the early renewal. On a trial, it applies at trial conversion. Renewal estimates, reminders, and delivery forecasts use the frozen target terms.

The frozen change still applies if you edit or archive the target plan afterward. It takes effect before the boundary payment attempt, so a failed renewal and its retries use the new plan. Grant access from the subscription's current subscription_plan_id, never from its pending snapshot.

Call change-plan again with period_end to replace the pending change. A successful now or prorated_now change, or any next_renewal change, clears it. Canceling the subscription, immediately or at period end, also clears it; reactivating does not restore it.

To keep the current plan, send {"scheduled_plan_change": null} to PATCH /v1/subscriptions/{subscription_id}, with optional expected_version. Any value other than null returns 400 INVALID_REQUEST, detail INVALID_VALUE; schedule through change-plan. Clearing when nothing is pending returns 200 unchanged, without an event or version increase. A stale expected_version still returns VERSION_CONFLICT.

While a change is pending, cadence, quantity, line creation, line updates, line deletion, change-quantity, and buyer swaps return 409 ACTION_NOT_ALLOWED, reason plan_change_scheduled. Clear or replace the change first. Payment method, metadata, and external_reference_id updates remain available. A delivery update must use a method offered by both the current plan and the frozen target, or it returns reason method_unavailable.

Prorated charges#

A now change, a prorated_now change, and a quantity change billed now all credit what the buyer paid for the part of the current period they won't use. Flint applies the credit as an order discount named "Unused time on" and the old plan's name, with source: "plan_change_credit", after the cycle's promotions. Tax is calculated on the discounted items, and shipping isn't credited.

Text
credit = basis * unused seconds / period seconds
  • Basis. What the buyer paid for the current period's items: the line subtotals less line discounts on an order that paid the period, before tax and shipping, less any refund on that order. For a signup order, only this subscription's lines count.
  • Time. The period runs from current_period_start_at to current_period_end_at; unused time runs from the change to current_period_end_at.
  • Rounding. Half up, to the smallest currency unit.

The credit is 0 when no Flint order paid the current period, such as an imported subscription before its first Flint charge, or when refunds returned everything paid for the items.

What the buyer pays differs by choice. now starts a new full period, so the charge is the new items' price for that period less the credit. prorated_now and a quantity change keep the period and charge only for the time left:

Text
charge = round(new items * unused seconds / period seconds) - credit

The new items are all of the subscription's items after the change, including lines that ship on a mixed subscription, at their cycle prices and after the cycle's promotions, before tax and shipping. Each term rounds half up once.

Example: starting a new period with now

A subscriber paid $29.00 for a monthly period from October 1 to November 1, 31 days. At midnight UTC on October 13, you move them to a $49.00 plan with billing_starts: "now", with 19 days unused:

Text
credit = 2900 * 19 / 31 = 1777.4, which rounds to 1777
Moving from a $29.00 plan to a $49.00 plan on October 13, before tax
  • New plan's itemspricing_amounts.subtotal_money
    $49.00
  • Unused time on Starterpricing_amounts.discount_money
    19 of 31 days
    −$17.77
  • Charged todaypricing_amounts.total_money
    $31.23

The new period runs from October 13 to November 13. The credit can't exceed what the new items cost after promotions, because Flint holds no balance to carry the difference; a downgrade is the usual cause of credit_exceeds_charge, and the credit is largest early in a period, when most of the paid time is unused.

A prorated order shows:

  • The lines at their cycle prices, and the cycle's promotions.
  • A discount with source: "proration" for the part of the period that has already passed.
  • The plan_change_credit discount for the unused time already paid.

The order carries the current subscription_cycle, the same number as the order that paid the period, and uses no cycle of a repeating promotion. Flint records it as paying for the time from the change to current_period_end_at. A later change in the same period therefore credits every order that paid for the time it replaces, each over the time it covers.

Example: two changes in one period

A subscriber pays $10.00 a seat. They renew for 5 seats, $50.00, for a 30-day period. Halfway through, you raise them to 10 seats with prorated_now:

Text
new items = 10 * 1000 = 10000
charge    = round(10000 * 1/2) - round(5000 * 1/2) = 5000 - 2500 = 2500
First change: 5 seats to 10 halfway through the period, before tax
  • 10 seatspricing_amounts.subtotal_money
    $100.00
  • Elapsed time in current perioddiscounts[0].applied_money
    Half of the period
    −$50.00
  • Unused time on Pro Plandiscounts[1].applied_money
    Half of the $50.00 paid
    −$25.00
  • Charged todaypricing_amounts.total_money
    $25.00

With a quarter of the period left, you raise them to 12 seats. Two orders paid for that time, so Flint credits both: the renewal's $50.00 covered the whole period, and the first change's $25.00 covered its second half.

Text
new items = 12 * 1000 = 12000
credit    = round(5000 * 1/4) + round(2500 * 1/2) = 1250 + 1250 = 2500
charge    = round(12000 * 1/4) - 2500 = 3000 - 2500 = 500
Second change: 10 seats to 12 with a quarter of the period left, before tax
  • 12 seatspricing_amounts.subtotal_money
    $120.00
  • Elapsed time in current perioddiscounts[0].applied_money
    Three quarters of the period
    −$90.00
  • Unused time on Pro Plandiscounts[1].applied_money
    A quarter of $50.00 and half of $25.00
    −$25.00
  • Charged todaypricing_amounts.total_money
    $5.00

Across the period the subscriber pays $50.00, $25.00, and $5.00 plus tax. The period, next_billing_at, billing_anchor_day, and completed_cycles are the same after both changes, and the next renewal bills 12 seats for a full period.

Refusals

A prorated_now plan change or a quantity change billed now returns 409 ACTION_NOT_ALLOWED and changes nothing when the charge can't be computed or collected:

reasonMeaning
credit_exceeds_chargeThe net is negative, such as a decrease. Flint holds no balance to carry the difference. Send a PATCH to apply a decrease at the next renewal, or period_end for a plan change.
minimum_chargeThe net is above zero and below the payment minimum. For these card charges, the minimum is $0.50 USD, or the merchant’s higher minimum from their rates or payment limits. Preview and confirmation both return the minimum in details[0].minimum_money. Make a larger change, or use PATCH to apply it at the next renewal.
paid_period_requiredNo Flint order paid the current period, such as an imported subscription before its first Flint charge. Use PATCH, which bills the change at the next renewal.
in_progressA refund on an order that paid the period hasn't settled. Send the change again once it has.
unsupported_stateThe subscription isn't active.
trial_in_progressThe subscription is in a free trial.
external_billing_scheduleThe subscription's dates come from an external schedule.
plan_change_scheduledA period_end change is pending. Clear it or replace it first. A prorated_now plan change doesn't hit this reason and clears the pending change instead.
already_appliedThe request leaves the subscription's quantities as they are.

If a renewal or another change is in progress, prorated_now returns 409 ACTION_NOT_ALLOWED with reason in_progress. If the subscription changes during preparation, it can return 409 VERSION_CONFLICT. The same key replays the conflict. Read the subscription and use a new key if you still want to make the change. A decline changes nothing, as for now.

What the new plan replaces#

  • Replaced. The lines become the target plan's current lines and prices, each with a new subscription_line_item_id, and lines you added or swapped since signup are dropped. The interval options, swap variants, delivery methods, and stock source come from the target plan.
  • Not applied. The target plan's trial and setup fee.
  • Kept. The contract dates and early_termination_fee_money, attached promotions, the card, the delivery preference, metadata, and external_reference_id.

For each target line, an explicit line_items quantity wins. Otherwise, Flint pairs current and target lines in this order, using each current line at most once:

  1. The same subscription_plan_line_item_id when repricing the same plan.
  2. When switching between two plans that both have a quantity-adjustable line, the adjustable lines pair. Fixed lines use their target quantities.
  3. The same variant_id or bundle_id on other plan changes.
  4. The only line on each side when both have one line.

A paired target line keeps the current line's quantity. An unpaired target line uses its plan quantity. If an unpaired current line has a quantity different from its plan line, or its plan line is gone and its quantity is greater than 1, the request fails with quantity_not_carried. Send quantities for every target line to make that choice explicit. There is no subscription-level multiplier.

If the carried seat quantity is outside the target plan's bounds, the merchant must send a quantity for the target seat line. The buyer's account leaves out that option.

Each renewal applies an attached promotion to the new items under the rules it had at signup, so a promotion that targeted a specific item stops matching once that item is gone. A now change is a charged cycle and uses one cycle of each repeating promotion.

Downgrades and price increases#

Use period_end for a downgrade that should preserve paid access. The buyer stays on the current plan until the next charged renewal, then moves to the frozen target terms. Use next_renewal when you intend to give the new plan immediately and charge its price starting with the next payment. To give part of a period back separately, refund the period's order with the refunds API.

Flint sends no plan change email. Tell the buyer before a new price takes effect. subscription.plan_change_scheduled tells you when a deferred change is scheduled or replaced, and a plan change preview gives the amount.

Events a plan change sends#

  • Scheduling or replacing period_end sends the snapshot event subscription.plan_change_scheduled.
  • Explicitly clearing a pending change with PATCH null sends the snapshot event subscription.plan_change_canceled. Clearing an already empty field sends nothing.
  • When the scheduled change takes effect, subscription.plan_changed is recorded before the boundary payment outcome.
  • next_renewal sends subscription.plan_changed.
  • A successful now sends subscription.payment_succeeded and subscription.plan_changed, and the order sends order.paid. A successful prorated_now sends the same events.
  • A quantity change billed now sends subscription.plan_changed and subscription.payment_succeeded, and the order sends order.paid. A prorated plan or quantity change with a net charge of 0 sends only subscription.plan_changed; it creates no order or payment attempt.
  • A declined now, prorated_now, or quantity change sends no subscription event, because nothing changed.

These specific events are not followed by subscription.updated. Cancellation and supersession show scheduled_plan_change: null on their existing event, without an extra subscription.plan_change_canceled. A change to effective_at alone does not send a replacement event. Events carry the subscription snapshot and do not record the previous plan: compare subscription_plan_id with the plan you provisioned. Webhook delivery is at least once and unordered; deduplicate by webhook_event_id and re-read the subscription when you need current state.

Preview a plan change#

POST /v1/subscription-previews with mode: "plan_change" estimates a change before you make it. It takes subscription_id, subscription_plan_id, and billing_starts (now, prorated_now, next_renewal, or period_end), plus the optional interval pair and line_items. It uses the same quantities and pairing rules as the change. Buyers preview their own with POST /v1/me/subscription-previews.

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-previews \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "mode": "plan_change",
    "subscription_id": "sub_1kmn0aExample",
    "subscription_plan_id": "plan_1kmn0bExample",
    "billing_starts": "now"
  }'

The response repeats the values the change would use and adds recurring_subtotal_money after the change, credit_adjustment_money (the credit for now and prorated_now, null for next_renewal and period_end), the required nullable effective_at, and renewal in the next-charge shape. For now, renewal is today's charge, with the credit in discounts as plan_change_credit. For prorated_now, renewal is today's prorated charge: the time already used appears in discounts with source: "proration", beside the plan_change_credit, and total_money is what the change would charge. For period_end, renewal estimates the boundary charge on the frozen target terms and effective_at follows the next billing date, or is null when there is none. A mode: "next_renewal" preview also uses pending target terms. The new lines don't exist yet, so line_items[].subscription_line_item_id is null. The preview runs the same checks and fails with the same errors as the change. The credit is measured at preview time, so the real one, measured a moment later, can be slightly lower. For prorated_now, the unused time is measured at preview time too, so the charge a moment later can differ slightly.

Preview a quantity change#

Use POST /v1/subscription-previews with subscription_id and line_items. For an immediate change, send mode: "quantity_change" and billing_starts: "prorated_now". For scheduled quantities, send mode: "next_renewal" with line_items. renewal.total_money estimates the charge with the new quantities. Send expected_version to check the subscription version before estimating.

Preview a buyer quantity change#

Buyers use the same preview inputs with POST /v1/me/subscription-previews and a full customer session. An immediate preview applies the rules for prorated_now. To estimate the next renewal with new quantities, send mode: "next_renewal" and line_items, then confirm with billing_starts: "period_end" on the change. Use this timing for a line that ships. The previews use the same adjustable line and quantity limits as the change.

cURL
curl -X POST https://api.withflintpay.com/v1/me/subscription-previews \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer CUSTOMER_SESSION_TOKEN" \
  -d '{
    "mode": "quantity_change",
    "subscription_id": "sub_1kmn0aExample",
    "billing_starts": "prorated_now",
    "line_items": [{"subscription_line_item_id": "sli_1kmn0aExample", "quantity": 8}],
    "expected_version": 9
  }'

Buyer self-service#

Buyers manage their subscriptions in Flint's buyer account, or in yours through a customer session:

Each field on the buyer PATCH needs its buyer action to be available: payment_method_id (update_payment_method), cancel_at_period_end: false (reactivate), scheduled_plan_change: null (cancel_plan_change), delivery (update_delivery), and the interval pair (update_billing_interval). A request with several fields applies all of them or none. When a buyer changes their address and the current method doesn't serve it, they choose a method that does in the same request. metadata, external_reference_id, and billing_schedule fail with detail code UNKNOWN_FIELD. Buyers can't add or remove lines. To change quantities, buyers use change-quantity on an adjustable line and preview it first. Each buyer write takes an optional expected_version.

The subscription's buyer_actions reports each action with whether it's available. An action the plan doesn't allow is unavailable with reason store_policy: update_billing_interval when the plan offers one interval, update_quantity when no line allows quantity adjustment, swap_items when no line has swap_variant_ids, and change_plan when the plan has no usable plan_change_options. Calling the route anyway returns 409 ACTION_NOT_ALLOWED, reason not_offered, with param naming the field.

These customer_account.buyer_capabilities settings govern delivery changes and skips:

SettingDefaultControls
can_update_deliverytrueWhether buyers can change their address and method. When false, a method_unavailable hold reports fixable_by: "merchant".
skip.enabledtrueWhether buyers can skip a renewal.
skip.max_consecutive_skipsNo limitHow many renewals in a row a buyer can skip, 1 to 12. At the limit, skip is unavailable with reason limit_reached, and the route returns 409 LIMIT_REACHED, reason consecutive_skips, until the next charged renewal. Your skips count toward it but aren't bound by it.

Let buyers change plans#

Buyers can move to the plans you list in the plan_change_options of the plan they're on. Each option has a target subscription_plan_id and billing_starts, now, prorated_now, next_renewal, or period_end, so you choose the timing for each path. Flint doesn't decide whether a path is an upgrade or a downgrade. A plan holds up to 25 options, PATCH replaces the whole list and needs the plan's expected_version, and the default [] turns buyer plan changes off for that plan. A prorated_now option requires the two plans to offer at least one shared billing interval and count. Your own change-plan calls aren't limited to the list.

Response
{
  "expected_version": 3,
  "plan_change_options": [
    {"subscription_plan_id": "plan_1kmn0bExample", "billing_starts": "prorated_now"},
    {"subscription_plan_id": "plan_1kmn0cExample", "billing_starts": "period_end"}
  ]
}

A subscription read through a customer session lists the options the buyer can use now in plan_change_options, each with subscription_plan_id, billing_starts, and a subscription_plan summary. Flint leaves out a target that isn't active, is priced in another currency, or ships when the subscription doesn't (or the reverse), and any option whose timing the subscription's state refuses. A now option follows the Order now rules; a prorated_now option follows the Prorated charges rules and is left out when either one ships or the target does not offer the subscription's current billing interval and count; a next_renewal option works in every status except canceled. A period_end option is available for active, trialing, and paused subscriptions without a scheduled cancellation, including an external schedule. A subscription that didn't come from a plan has none. The change_plan action is available when the list isn't empty. Otherwise it reads store_policy when no option has a usable target, not_in_state when the subscription's state rules out every option, and sign_in_required on an access link.

POST /v1/me/subscriptions/{subscription_id}/change-plan makes the change. It takes a full customer session, not an access link: the change can charge the buyer, so an access link for one subscription, including a subscription_manage link, can't make it. Send an Idempotency-Key. Flint stores each key with its change, so an exact retry returns the stored result, and a second key is a second change that charges again with now or prorated_now.

cURL
curl -X POST https://api.withflintpay.com/v1/me/subscriptions/sub_1kmn0aExample/change-plan \
  -H "Authorization: Bearer flint_cses_example" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: buyer-change-plan-001" \
  -d '{"subscription_plan_id": "plan_1kmn0bExample"}'

The body needs subscription_plan_id. billing_interval with billing_interval_count, and expected_version are optional and work as they do for your own change. The option sets billing_starts, so a body with billing_starts or line_items fails with UNKNOWN_FIELD.

The response is subscription, billing_starts, order, and order_payment_attempt, with 200 even when the payment is declined. A now change credits the unused time and charges the rest under the same rules, including credit_exceeds_charge; read order_payment_attempt.status for the outcome. A prorated_now change keeps the current period and billing date, and charges the prorated difference under the same rules. A next_renewal change switches the plan immediately and charges and credits nothing. The current period and next_billing_at stay, and order and order_payment_attempt are null. A period_end change keeps the current plan and returns a non-null scheduled_plan_change; order and order_payment_attempt are null. The buyer snapshot adds a subscription_plan summary of the target. Grant access from the current subscription_plan_id.

ResponseCause
400 INVALID_REQUEST, INVALID_VALUEsubscription_plan_id isn't one of the subscription's current options, whether or not the plan exists.
409 ACTION_NOT_ALLOWED, reason not_offeredThe plan has no usable plan_change_options.
409 ACTION_NOT_ALLOWED, other reasonsThe state refusals your own change returns, such as trial_in_progress.
409 OPERATION_IN_PROGRESS, VERSION_CONFLICT, INVENTORY_INSUFFICIENT, or MERCHANT_NOT_READYAs for your own change.

POST /v1/me/subscription-previews with mode: "plan_change" previews a change before the buyer confirms it. It takes subscription_id, subscription_plan_id, and the optional interval pair, and returns the plan change preview with the same checks and errors as the change. For a prorated_now option, its renewal.total_money is the amount the buyer pays today, so show it before they confirm.

To undo a buyer-scheduled change, offer a "Keep current plan" control when cancel_plan_change is available and send {"scheduled_plan_change": null} to PATCH /v1/me/subscriptions/{subscription_id}. Its session requirements match reactivate, including a subscription_manage access link. A merchant-scheduled change has requested_by: "merchant"; the action is unavailable with reason store_policy, and a buyer clear returns 409 ACTION_NOT_ALLOWED, reason not_offered. While a change is pending, update_billing_interval, update_quantity, and swap_items are unavailable with reason not_in_state.

The change sends the plan change events, including subscription.plan_change_scheduled for period_end and subscription.plan_change_canceled for an explicit clear. Editing plan_change_options sends no webhook. Flint sends no plan change email.

Manage plans over time#

PATCH /v1/subscription-plans/{subscription_plan_id} changes a plan for future subscribers. Existing subscriptions keep billing on the prices they signed up with until you change their plan.

  • An omitted field keeps its value. null clears description, external_reference_id, trial_period_days, setup_fee_money, contract_term_months, and early_termination_fee_money; on any other field it fails with 400 INVALID_REQUEST, detail code INVALID_VALUE.
  • To replace line_items or images, send the complete array with the plan's current version as expected_version. See Replace plan line items.
  • metadata merges by key; set a key to null to remove it.
  • [] on subscription_delivery_method_ids offers the store's checkout default methods, and [] on billing_interval_options offers only the plan's own interval.
  • Removing a delivery method or interval changes what new subscribers can choose, and what current subscribers can change to. Changing the adjustable line's bounds affects new subscribers and new checkouts only. A current subscriber keeps the method, interval, quantity, and bounds they have.

Offer intervals and quantities#

One plan can offer several cadences, and one of its lines can let the buyer choose a quantity, whether or not it ships. The buyer picks both at signup and can change them later.

Prices of lines that ship are per delivery, and each interval option charges for all deliveries in its period. Without a delivery cadence there is one delivery per period, so every option bills the same line prices once per period: a USD 15.00 line bills USD 15.00 each month on monthly and USD 15.00 each year on yearly, before quantities, discounts, shipping, and tax. With a delivery cadence, a longer period bills more deliveries of the lines that ship, and other lines bill once per period. For a different price per interval without a delivery cadence, create a separate plan, such as an annual one, and use change-plan to move between plans.

Creating or updating a subscription plan or offer with several interval options and no lines that ship returns meta.warnings[] with code billing_interval_options_same_price and severity warning. The request succeeds; the warning calls out the shared prices.

JSON
{
  "billing_interval": "weekly",
  "billing_interval_count": 4,
  "billing_interval_options": [
    {"billing_interval": "weekly", "billing_interval_count": 2},
    {"billing_interval": "weekly", "billing_interval_count": 4},
    {"billing_interval": "weekly", "billing_interval_count": 6}
  ]
}
  • billing_interval_options holds up to 12 distinct pairs and must include the plan's own pair, which is the default.
  • To change the plan's billing_interval to a pair the stored options don't include, send the new options in the same request.
  • Responses carry the full interval list, with the plan's own pair first.

Line quantities are the units billed and delivered. For six bottles, set the bottle line's quantity to 6; for three boxes, use a bundle line at quantity 3. Digital seats use the one line marked allow_quantity_adjustment. recurring_subtotal_money is one period's items before discounts, shipping, and tax. Each line supports 1 to 9,999 units. Nothing multiplies a line, and neither subscriptions nor plans have a quantity multiplier. The changelog entry shows how earlier requests map to line quantities.

Example: a per-seat plan#

A SaaS plan with a base fee, a seat line, and an add-on. Only the seat line has allow_quantity_adjustment: true, so only its quantity is the seat count. Buyers can set it from 3 to 100 seats; you can set any line from 1 to 9,999.

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-plans \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: plan-team-monthly-v1" \
  -d '{
    "name": "Team monthly",
    "billing_interval": "monthly",
    "billing_interval_count": 1,
    "currency": "USD",
    "line_items": [
      {
        "type": "custom",
        "name": "Platform fee",
        "unit_price_money": {"amount": 4900, "currency": "USD"},
        "quantity": 1
      },
      {
        "type": "custom",
        "name": "Seats",
        "unit_price_money": {"amount": 1000, "currency": "USD"},
        "quantity": 5,
        "allow_quantity_adjustment": true,
        "min_quantity": 3,
        "max_quantity": 100
      },
      {
        "type": "custom",
        "name": "Priority support",
        "unit_price_money": {"amount": 2500, "currency": "USD"},
        "quantity": 1
      }
    ]
  }'

The plan bills $49.00 + 5 x $10.00 + $25.00 = $124.00 a cycle. To start a customer with 12 seats, send the seat line's subscription_plan_line_item_id in terms.line_items with "quantity": 12, as in Choose seats at signup; the other lines keep their plan quantities. Later, change-quantity takes the subscription's own subscription_line_item_id for the seat line, and a buyer can change only that line, within 3 to 100.

Example: boxes of physical goods#

For physical goods, sell the box as a bundle line. The number of boxes is the line's quantity, so three boxes each cycle is "quantity": 3 on one bundle line, not a multiplier on the subscription. Ship physical products shows the plan line and the delivery setup.

Stop selling a plan#

A plan's status is active, inactive, or archived. Set it to inactive to stop new signups while current subscribers keep renewing:

cURL
curl -X PATCH https://api.withflintpay.com/v1/subscription-plans/plan_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"expected_version": 4, "status": "inactive"}'

An inactive plan takes no new subscribers. Creating a subscription on it, previewing one, creating a checkout session or payment link for it, paying an order that signs up for it, and changing a subscription to it each return 409 ACTION_NOT_ALLOWED, reason unsupported_state, with current_status: "inactive". Existing subscriptions keep renewing, and the plan's interval, quantity, swap, and delivery options still apply to them. The plan stays editable, and setting it back to active takes signups again.

While an active payment link sells the plan, the change fails with 409 RESOURCE_IN_USE. details[0].blocking_resources lists up to 25 payment_link references, and blocking_resource_count the total. Deactivate the links, then retry. Subscriptions and open checkout sessions don't block it, but a buyer already in a session for the plan can't finish paying.

Archive a plan#

cURL
curl -X DELETE https://api.withflintpay.com/v1/subscription-plans/plan_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY"

DELETE archives a plan for good: it can't be edited or activated again, it stays readable for history, and signups on it return 409 ACTION_NOT_ALLOWED, reason archived. Archive a plan only when nothing is left on it; to stop selling a plan that has subscribers, set it to inactive. While subscriptions, payment links, or checkout sessions still use the plan, archiving fails with 409 RESOURCE_IN_USE, listing them in details[0].blocking_resources.

GET /v1/subscription-plans returns active and inactive plans unless you filter by status; pass status=archived for archived ones.

Retrieve and list#

Fetch one subscription, with related records expanded:

cURL
curl "https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample?expand=customer,payment_method,subscription_plan" \
  -H "Authorization: Bearer YOUR_API_KEY"

List subscriptions for dashboards and back-office tools:

cURL
curl "https://api.withflintpay.com/v1/subscriptions?status=active&sort_by=next_billing_at&sort_direction=asc" \
  -H "Authorization: Bearer YOUR_API_KEY"
FilterFinds
status, customer_id, subscription_plan_id, subscription_offer_id, terms_typeSubscriptions by status, customer, plan, offer, or kind
external_reference_id, idempotency_keyThe subscription you created under your own ID or a create's key
billing_schedule_owner, is_awaiting_billing_schedule, cancel_at_period_endSchedules waiting on you, or subscriptions set to cancel
next_billing_after, next_billing_beforeWhat bills in a window, such as this week. Only subscriptions with a scheduled renewal match.
needs_attention, hold_reason, delivery_method_idSubscriptions that need you; see Renewals that need attention
querySubscription ID, external reference ID, customer, and plan. IDs match from the start and need their prefix, such as sub_01
created_after, created_before, updated_after, updated_before, test_clock_idTime ranges (*_after inclusive, *_before exclusive) and test clocks

Plans filter by status, external_reference_id, query, and created or updated time. Both lists use cursor pagination.

Ship physical products#

Physical plans, delivery preferences, held renewals, and delivery method migrations are in Subscriptions that ship. Signup, renewals, failed payments, and cancellation work the same for them.

Sell subscriptions across your catalog#

Subscribe-and-save offers, mixed carts, and offer subscriptions are in Subscriptions that ship. Their renewals, failed payments, and cancellations work like those of any other subscription.

Import subscribers from another tool#

Moving subscribers takes two things: a create request with billing_start.type of imported, and a check of every request before you create any. Each subscriber needs a saved Flint card before their first charge. Contact Flint separately to migrate eligible saved cards from Stripe, Square, or another processor that can export to Stripe. Pass the migrated Flint payment_method_id in the create request to bind the card in the same step. If the card isn't ready, see Import without a card.

Preview first. POST /v1/subscription-previews with mode: "create" takes a complete create request, checks its proposed terms, billing schedule, and delivery quote, and creates nothing. The create checks for an existing subscription with the same external reference when it saves the import:

Shell
period_start=$(date -u -d '4 days ago' +%Y-%m-%dT00:00:00Z) # as in the import above

curl -X POST https://api.withflintpay.com/v1/subscription-previews \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "mode": "create",
    "subscription": {
      "terms": {
        "type": "subscription_plan",
        "subscription_plan_id": "plan_1kmn0aExample"
      },
      "customer_id": "cus_1kmn0aExample",
      "payment_method_id": "pm_1kmn0aExample",
      "billing_start": {
        "type": "imported",
        "period_started_at": "'"$period_start"'",
        "completed_cycles": 10
      },
      "delivery": {
        "type": "shipment",
        "delivery_method_id": "dmet_1kmn0aExample",
        "destination": {
          "type": "customer_address",
          "customer_address_id": "caddr_1kmn0aExample"
        }
      }
    }
  }'

The create preview returns mode: "create", is_valid, errors, first_charge, first_period_charge, and recurring. is_valid means the inputs are valid and priceable, not that the subscription is ready to pay. It checks cards the same way creation does: imports and trials with nothing to charge at creation may omit a card, while immediate starts, scheduled starts, and setup fees still require one. An explicit or default card must be usable.

first_charge estimates the first Flint collection: trial end without a setup fee, now with a setup fee, or the end of an imported period. A scheduled start defers a setup fee until that start. recurring estimates the first normal full-period collection without setup fees. When there is no setup fee and prorate_first_period isn't set, both describe the same collection. Imported collections use completed_cycles + 1; imported setup fees are not collected. Setup fees are separate orders, so their estimate has subscription_cycle: 0 and isn't added to the recurring merchandise amount.

With prorate_first_period: true, the preview prices each collection the way billing makes it. The prorated first period is cycle 1, billed at the first paid start: now, trial end, or starts_at. recurring is cycle 2, the first full period, billed at the anchor that ends the prorated period. Without a setup fee, first_charge is the prorated period. With one, first_charge is the setup fee and first_period_charge is the prorated period, because billing collects them as separate orders. first_period_charge is null when no proration was requested, when the prorated period is already included in first_charge, or when the first paid start is on the anchor day, so there is no prorated period. A start on the anchor day is a normal full first period, so without a setup fee first_charge and recurring describe the same cycle 1 collection.

For the $50 example above, created July 10 at noon UTC with a $5 setup fee, the preview returns a $5 first_charge (subscription_cycle: 0) and a $25 first_period_charge (subscription_cycle: 1), both billed July 10, and a $50 recurring (subscription_cycle: 2) billed July 25. A promotion that covers only the first cycle discounts the $25 charge and not the July 25 one.

Each block uses the next-charge fields: billing_at, currency, subscription_cycle, line_items, discounts, subtotal_money, discount_money, shipping_money, tax_money, and total_money. New lines have subscription_line_item_id: null. Frozen recurring promotions apply according to their remaining paid cycles, without consuming a use. For an imported external schedule, billing_at is null until you supply the next boundary, but known terms are still priced. tax_money is null when tax can't be calculated yet; total_money then excludes unresolved tax. These are estimates, not a final charge guarantee.

All three blocks are null when validation prevents pricing. errors contains a code, a message, and when they apply, param and details. A param is prefixed with subscription., such as subscription.terms.subscription_plan_id. When the body is valid, is_valid is true and errors is []. For an offer import, send offer terms the same way, as in Create or import an offer subscription directly. Offer problems come back one at a time, in line order (an unknown or inactive offer, a variant the offer doesn't cover, a discount that can't apply, an interval the offers don't share), so preview again after each fix until is_valid is true. The preview never charges or attaches a discount, and you can repeat it.

Keep the buyer's remaining discount. Include promotions in the create request and its preview. For a repeating promotion with period_count: 3, an entry such as {"promotion":{"promotion_code":"MIGRATED20"},"consumed_cycles":2} keeps one discounted cycle. The first eligible cycle defaults to billing_start.completed_cycles + 1; send first_cycle to start later. consumed_cycles is accepted only for imports, defaults to 0, must be less than period_count for repeating promotions, and must be 0 for once or forever. Each attachment counts one promotion use and, when sent by code, one code use. Previewing counts none. See attaching promotions on create or import.

Then create, once per subscriber.

  • Send the same bodies to POST /v1/subscriptions, one Idempotency-Key per subscriber, reused on retries. The same key and body returns the subscription the first call created.
  • Set external_reference_id to the subscription's ID in the old tool. An imported create returns 409 ALREADY_EXISTS if a subscription with that reference has not ended in the same merchant environment, even under a new idempotency key. Retrieve the subscription in details[0].current_resource and continue with its ID. A scheduled cancellation still blocks reimport until the subscription ends. The create checks this when it saves the import; a preview does not reserve the reference.
  • completed_cycles continues the old tool's count, so a subscriber with ten shipments behind them doesn't get a first-box insert.
  • Compare next_billing_at with the period end in the old tool. The first period ends one full interval after period_started_at, so a subscriber whose old period is shorter than an interval gets unbilled days. When the dates differ, PATCH /v1/subscriptions/{subscription_id} with billing_schedule: {"owner": "flint", "next_billing_at": <old period end>, "billing_anchor_day": <day>}, as Control the billing schedule describes.
  • Each imported subscriber gets Flint's "You're subscribed" email, and a card request when the import has no card. Flint's email quotes the next_billing_at from the create, so it shows the wrong date for a subscriber whose date you correct. Set customer_email_delivery.subscription_lifecycle to merchant_sends before importing to send your own; see customer email delivery.

The dashboard's CSV import, and the Flint CLI, use the same preview. CSV import covers plan subscriptions; import offer subscriptions through the API.

Import without a card#

An imported subscription doesn't need a card at creation, because the buyer has already paid for the current period. Omit payment_method_id and Flint uses the customer's default card. If the customer has no default card, the subscription is created with payment_method_id: null. If the customer has a default card that can't be used, the request fails. A payment_method_id you send must still be valid, or the request fails as before. Immediate starts that charge at creation and scheduled starts still require a card. A trial can start without one.

An unbound subscription keeps its normal status, and Flint adds no status or event for it. It reports when it needs a card in payment_method_due_at, an RFC 3339 time:

  • payment_method_id is null until a card is bound.
  • payment_method_due_at is the next scheduled billing date while no card is bound, even when that cycle's charge is zero. If that renewal's charge is positive, the subscription becomes past_due without a payment attempt. If it is zero, the renewal completes without a card and the deadline moves to the following billing date. It is null once a card is bound, when the billing date is unknown because an external schedule has no next_billing_at, and while the subscription is paused, canceled, or set to cancel at period end.

Both fields are on every read, list, and subscription.* webhook object. The subscription.created object for an import without a card carries payment_method_id: null and the due time.

Bind the card. Once the subscriber has an active card, PATCH /v1/subscriptions/{subscription_id} with its payment_method_id, as in Recover with a new card. Saving a card or setting it as the customer's default doesn't bind it to a subscription that already exists.

Ask the buyer for a card. Who sends the request follows the subscription_lifecycle setting in customer email delivery:

  • flint_sends. Flint emails the buyer a link to add a card. It goes out 3 days before the billing date, or right away when the date is closer than that, and it doesn't depend on the optional renewal reminder. The link shows the terms Flint will charge, including a pending scheduled plan change. With an external schedule and no next_billing_at, Flint waits and sends nothing until you set the date.
  • merchant_sends. Flint sends no request. Ask the buyer yourself when you receive subscription.created, and use payment_method_due_at as the deadline.

If the date arrives without a card. A renewal with a positive balance doesn't charge anything. The subscription becomes past_due through the normal path, with no payment attempt and no last_payment_error, and your dunning end action applies as configured. Scheduled retries do nothing until a card is bound. Bind one and the next retry charges it, or follow Recover with a new card. A renewal with a zero balance collects as usual without a card.

Trial without a card#

A subscription to a plan with a trial can start without a card when nothing is charged at creation. Omit payment_method_id and Flint uses the customer's default card. If the customer has no default card, the subscription starts trialing with payment_method_id: null. A plan with a setup fee, or any start that charges at creation, still requires a card and fails with detail code REQUIRED when none is available.

The fields work as they do for an import without a card. While no card is bound, payment_method_due_at is the first charge boundary: the trial end, or a later first charge if the schedule changes. It is null once a card is bound, and Flint recomputes it when a schedule change moves the first charge. Flint adds no status or event for a trial without a card.

Ask the buyer for a card. Who sends the request follows the subscription_lifecycle setting in customer email delivery:

  • flint_sends. Flint sends the trial-ending email 3 days before the current first charge boundary, or right away when less time remains, and it asks the buyer to choose a card instead of announcing a charge. Its link opens the same update-card page as any other card request.
  • merchant_sends. Flint sends no request. Ask the buyer yourself when you receive subscription.trial_ending, and use payment_method_due_at as the deadline.

Bind the card. PATCH /v1/subscriptions/{subscription_id} with an active card's payment_method_id, as for an import. The subscription stays trialing and charges the card at the first charge boundary. It stays trialing until that charge resolves, then follows Free trials.

If the boundary arrives without a card. Flint doesn't charge anything. It cancels the subscription and sends subscription.canceled, with the same cancellation email as any other cancellation.

Charge a platform fee#

A platform that bills its merchants' customers by subscription can take a fee on every payment Flint collects for a subscription: the first charge, each renewal, each retry, and each prorated change. Set a platform_fee_rule with a partner app token, from the app install that created the subscription or the checkout session that started it. Flint prices each payment from the rule, so your app doesn't have to be online for a renewal.

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions \
  -H "Authorization: Bearer PARTNER_APP_TOKEN" \
  -H "Flint-Merchant-Id: mer_01KEZF7C00MPP0T9S0KH5BB4CC" \
  -H "Idempotency-Key: classboard-member-4410" \
  -H "Content-Type: application/json" \
  -d '{
    "terms": {
      "type": "subscription_plan",
      "subscription_plan_id": "plan_1kmn0aExample"
    },
    "customer_id": "cus_1kmn0aExample",
    "payment_method_id": "pm_1kmn0aExample",
    "billing_start": {"type": "immediate"},
    "billing_schedule": {"owner": "flint"},
    "platform_fee_rule": {"percent": 2, "maximum_fee_money": {"amount": 400, "currency": "USD"}}
  }'

The rule has percent, an optional fixed_fee_money, and an optional maximum_fee_money, and it must stay within the cap the merchant approved. Each payment carries a fee of percent of what it collects, plus the fixed amount, up to the maximum and the cap. A $89.00 renewal under a 2% rule carries a $1.78 fee.

  • Each payment gets its own fee. A renewal, an automatic retry, a retry the merchant or buyer starts, a setup fee, and a billed-now change each get a PlatformFee, priced on what that payment collects. A cycle that credit or a gift card covers in full creates no processor payment and no fee.
  • Change it with PATCH. PATCH /v1/subscriptions/{subscription_id} with platform_fee_rule and expected_version replaces the whole rule, and null removes it. Payments created afterward use the new rule, and a payment already created keeps its fee. Send platform_fee_rule alone or with the other editable fields, but not with billing_schedule.
  • A plan change keeps the rule. Change the rule in the same PATCH or a later one when the new plan is priced differently.
  • A signup keeps the rule. A rule on the checkout session that starts the subscription prices the first payment, and Flint copies it onto the subscription. See Start a subscription signup.
  • Removing the app ends the rule. When the merchant removes your app, or you revoke the install, the rule ends for good. Renewals keep running without the fee, and authorizing again doesn't bring it back.
  • Buyers never see it. The buyer's subscription, in their account or on a customer session, leaves platform_fee_rule out. Merchants read it on the subscription.

Setting, replacing, or removing a rule advances version. The event includes the whole previous rule in data.previous_attributes.platform_fee_rule, or null the first time. Flint sends subscription.updated unless the same write triggers a more specific event, such as subscription.reactivated, which then carries the change. A revoke sends subscription.updated when it ends the rule. After the merchant authorizes again, sending the same rule binds it to the new authorization. When the subscription still shows that rule, the version stays the same and Flint sends no event. subscription.created carries the rule when you set it at create or Flint copied it from the session.

Live rules need your app to be an approved platform that accepted a Platform Agreement version that covers rules. If a check fails, Flint creates and changes nothing. Platform fees lists the checks and the errors, and Fees a rule priced shows how to read each fee.

Errors you will hit#

These are the refusals most integrations meet. Error handling covers the envelope they arrive in.

CodeReason or detail codeWhenWhat to do
409 ACTION_NOT_ALLOWEDstatus_not_reachedThe card is still in setup.Wait for payment_method.activated, then send the request again. next_steps says whether you can reuse its Idempotency-Key.
409 ACTION_NOT_ALLOWEDVaries: details[0].reasonThe subscription's state refuses the action.Branch on details[0].reason and read details[0].current_status. See When a subscription refuses an action.
409 ACTION_NOT_ALLOWEDunsupported_state or archivedA signup or plan change names a plan that is inactive or archived, or an offer that is inactive or whose discount can't apply.Use an active plan or offer.
409 ACTION_NOT_ALLOWEDnot_offeredA buyer asks for something the store or plan doesn't let buyers do, such as pausing, skipping, changing delivery, interval, or quantity, swapping a line, or canceling now.Offer only actions whose buyer_actions entry is available.
409 ACTION_NOT_ALLOWEDcredit_exceeds_charge, minimum_charge, or paid_period_requiredA prorated_now plan change or a quantity change billed now would net a negative amount or a positive amount below the payment minimum, or no Flint order paid the period.Apply the change at the next renewal with PATCH or period_end. See Prorated charges.
409 ACTION_NOT_ALLOWEDconfiguration_requiredA physical plan has a line with no delivery profile, or a profile that isn't finished. Or tax asks for callback tax and no tax calculation callback is selected, with details[0].resource_type tax_calculation_callback.Complete the profile named in details[0]. See Set up a physical plan. For tax, select a callback in tax.calculation_callback_id.
400 INVALID_REQUESTREQUIREDNo payment_method_id and no default card on a start other than imported, no delivery for a subscription that ships, a missing required field such as billing_start, or a change-quantity request without line_items.Send the missing field, which param names.
400 INVALID_REQUESTNOT_ALLOWEDA field the context rejects, such as billing_anchor_day on daily or weekly billing or without an explicit flint schedule, a scheduled start on a plan with a trial, a trial on a physical plan, a card of another customer, a plan change to another currency, a prorated_now plan change that would change the interval or involves a plan that ships, a prorated quantity change to a line that ships.Remove or change the field param names.
400 INVALID_REQUESTINVALID_VALUEA value is out of range, such as an interval or quantity the plan doesn't offer, a line over 9,999 units, an imported period that has ended, a past starts_at, a schedule moved more than one interval, or an end_after that is already behind the subscription.Send a value in range for the field param names.
400 INVALID_REQUESTUNKNOWN_FIELDA field from the other terms branch, billing_anchor_day on an external schedule, or a merchant-only field on a buyer request.Remove the field.
409 ALREADY_EXISTSNoneAn imported create uses an external_reference_id held by a subscription that has not ended in this merchant environment.Retrieve the subscription in details[0].current_resource and continue the migration with its ID.
409 ACTION_NOT_ALLOWEDplatform_fee_consent_required, platform_onboarding_required, platform_pending_review, platform_rejected, or platform_capability_inactiveA platform_fee_rule needs a cap the merchant approved, and in live mode an approved platform that accepted the Platform Agreement version that covers rules. param is platform_fee_rule.Follow next_steps. See Platform fees.
400 INVALID_REQUESTNOT_ALLOWED or INVALID_VALUE on platform_fee_ruleThe credential isn't a partner app token, the app didn't create the subscription, or the rule is out of range or over the merchant's cap. A money member over the cap returns the largest allowed value in details[0].maximum_money.Fix the member param names, or set the rule from the install that created the subscription.
409 VERSION_CONFLICTNoneexpected_version doesn't match.Read the subscription again. details[0].current_version has its version.
409 LIMIT_REACHEDconsecutive_skipsThe buyer has skipped max_consecutive_skips renewals in a row.Wait for the next charged renewal, which resets the count.
409 RESOURCE_IN_USENoneA plan is set to inactive while payment links sell it, or archived while subscriptions, links, or sessions use it.Read details[0].blocking_resources, which lists them.
502 EXTERNAL_SERVICE_ERRORrate_unavailableA delivery rate can't be calculated.Retry the same request with the same Idempotency-Key after a backoff. See When a delivery preference can't ship.

Common mistakes#

  • Creating the subscription the moment the browser confirms setup. The card is still pending for a moment. Wait for payment_method.activated.
  • Provisioning from the create response. incomplete and scheduled aren't paid. Provision on subscription.activated, or on trialing.
  • Expecting plan edits to reprice subscribers. Prices are locked at signup. Change their plan, to a new plan or the same one.
  • Treating cancel as immediate. The default waits for the end of the trial or paid period, or the next retry. Send cancel_immediately: true when you mean now.
  • Resuming a past_due subscription, or undoing a cancellation with resume. Resume is for paused only. Fix the card to recover a past-due subscription, and send cancel_at_period_end: false to undo a cancellation.
  • Sending quantity on subscription PATCH. The field returns UNKNOWN_FIELD. Use change-quantity with line_items and choose when billing starts.
  • Using now to add seats. It starts a new period and moves billing_anchor_day. Use prorated_now to keep the period.
  • Using immediate to import a subscriber. They pay twice for the current period. Use imported.

Next steps#

Subscription payment linksA hosted signup page for a plan, with no frontend code.Subscriptions that shipPhysical plans, delivery holds, subscribe-and-save offers, and mixed carts.Headless customer accountsBuild the buyer's own cancel, pause, skip, and card controls.Test subscriptions and renewalsRehearse trials, renewals, and dunning on a test clock.Subscriptions API referenceEvery field and endpoint, with status definitions.

Negotiated prices#

Subscription offers and newly added or swapped subscription catalog lines use the customer’s negotiated prices and their own quantities. The selected prices remain locked through renewals. Authored subscription plans keep their own prices.

List recurring lines with GET /v1/subscriptions/{subscription_id}/line-items, using page_size and page_token. Results are sorted by line ID in ascending order. Creating a line on the same path accepts expected_subscription_version from the subscription's last read; a stale value returns 409 VERSION_CONFLICT.

Was this helpful?