Skip to main content

Subscriptions

In a nutshell

A subscription connects a customer to a plan and tracks when the customer should be billed next.

What a subscription tracks

FieldDescription
codePublic subscription code, such as SUB_a1b2c3d4.
customerIdCustomer being billed.
planIdPlan used for billing.
paymentSourceIdSaved payment source, when available.
amountSubscription amount in minor units.
currencySubscription currency.
intervalBilling interval.
trialStartDateTrial start date, if the plan has a trial.
trialEndDateTrial end date, if the plan has a trial.
currentBillingCycleStartCurrent billing period start.
currentBillingCycleEndCurrent billing period end.
statusSubscription lifecycle status.

Subscription creation

You can create a subscription for an existing customer and plan:
curl -X POST https://api.example.com/v1/subscription/ \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: sub_xxx" \
  -d '{
    "customerEmailOrCode": "customer@example.com",
    "planCode": "PLN_8AbC123x"
  }'
If the customer already has an active card token saved, the engine can use it for future billing. If no payment source exists, use checkout to collect and tokenize the first card payment.

API

See Subscriptions API Reference.