Skip to main content
POST
Create a subscription payment

Authorizations

X-Suby-Api-Key
string
header
required

API key authentication

Body

application/json
productId
string
required

ID of a subscription product

Example:

"pro_sub456"

customerId
string

Optional. Links the subscription to an existing customer by their stable id (as returned by GET /api/customer and on payment responses/webhooks). Keeps the same customer linked even if their email has changed. Takes precedence over customerEmail. Returns 404 if unknown.

Maximum string length: 255
Example:

"usr_abc123"

customerEmail
string<email>

Optional. If provided (and no customerId is given), a user account is created (or reused by email) immediately and linked to the payment. If both are omitted, the payment is created without a customer; the email is collected on the hosted checkout page.

Example:

"customer@example.com"

customerFirstName
string

Optional. Customer first name. Backfills the display name when the customer has none. Ignored when neither customerId nor customerEmail is provided.

Maximum string length: 100
Example:

"John"

customerLastName
string

Optional. Customer last name. Backfills the display name when the customer has none. Ignored when neither customerId nor customerEmail is provided.

Maximum string length: 100
Example:

"Doe"

priceCents
string

Price in cents as a string. Required when the product has isCustomPrice: true. Must NOT be provided for fixed-price products. This price is locked for all future renewals.

Example:

"999"

currency
enum<string>

Currency for the price. Required when priceCents is provided, ignored otherwise.

Available options:
USD,
EUR
discountCode
string

Optional. A discount code (created via POST /api/discount/create) to pre-apply to this subscription checkout. Applied to the amount the customer pays. Ignored if the code is invalid, expired, exhausted, or not attached to this product.

Maximum string length: 50
Example:

"WELCOME10"

externalRef
string

Your internal reference for this subscription (e.g. an end-user account or wallet id). It is the subscription-ownership key: reusing the same externalRef for the same customer + product renews the existing subscription, while a different externalRef creates a separate subscription that is billed and renewed independently. Omit it to place the subscription in the shared "no external reference" bucket for that customer + product. Returned on the subscription object and on every subscription webhook.

Maximum string length: 255
Example:

"sub_ref_001"

metadata
object
customFields
object[]

Extra fields shown on the checkout page to collect information from the customer (e.g. Discord username, referral source, terms acceptance). Fields are collected on the initial checkout only — renewal payments do not re-prompt the customer. The initial payment webhook carries the responses in context.customFieldsResponse; renewal webhooks have it set to null.

Maximum 10 fields per subscription.

Maximum array length: 10
successUrl
string<uri>
cancelUrl
string<uri>

Response

Subscription payment created

success
boolean
Example:

true

data
object