Subscriptions

Create Subscription

Create a new Subscription for a User. User must have a valid customer ID of Payment Provider set. Requires billing details with at least a country code and postal code if country is one of US, CA, UA, IN. Multiple items (up to 20) can be billed on a single Subscription — for example a base plan plus add-ons — and each line is preserved on the invoice and outbound webhooks. Because one Subscription maps to a single billing arrangement, every item must be on the same cadence: - Currency: all items must resolve to the same currency (from the item or its Offer). - Billing period: all Offers must share the same recurring interval and interval count (e.g. all monthly); mixing intervals (monthly + yearly) returns a 400. - Every item must reference a recurring Offer via offerId. - Trial: a trial (trialEnd / the Offer trial) is only applied to single-item Subscriptions. Multi-item Subscriptions start billing immediately (no trial). - Discount codes are not supported for multi-item Subscriptions. Note: User must have a valid customer ID of Payment Provider set and this customer must have a valid default payment method set (Payment Provider dashboard).

Authorization

Public key Secret key
x-fngs-public-key<token>

In: header

x-fngs-secret-key<token>

In: header

Request Body

application/json

POST /v0/subscriptions/create Request body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

POST
/v0/subscriptions/create
curl -X POST "https://example.com/v0/subscriptions/create" \  -H "Content-Type: application/json" \  -d '{    "items": [      {}    ]  }'
{  "status": "success",  "data": {    "subscription": {      "object": "subscription",      "id": "string",      "status": "all",      "createdAt": 0,      "currentIntervalEnd": 0,      "currentIntervalStart": 0,      "cancelAtIntervalEnd": false,      "canceledAt": null,      "userId": null,      "user": null,      "orderId": "b3e1eced-f2bd-4d8c-9765-fbc9d1d222d5",      "orderNumber": "string",      "order": {        "object": "order",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "number": "string",        "status": "PENDING"      },      "lastPaymentId": null,      "lastPaymentNumber": null,      "lastPayment": null    }  }}