Skip to main content
POST
Create a new subscription contract

Headers

X-API-Key
string
required

API Key

Query Parameters

api_key
string

API Key (Deprecated)

Body

application/json

Request object for creating a new subscription contract

billingIntervalCount
integer<int32>
required

Number of intervals between billings

Required range: x >= 1
Example:

1

billingIntervalType
enum<string>
required

Billing frequency interval type

Available options:
DAY,
WEEK,
MONTH,
YEAR,
$UNKNOWN,
DAY,
WEEK,
MONTH,
YEAR
Example:

"MONTH"

customerId
string
required

Shopify customer ID (numeric ID without gid prefix)

Example:

"987654321"

deliveryAddress1
string
required

Delivery address line 1

Example:

"123 Main St"

deliveryCity
string
required

Delivery address city

Example:

"New York"

deliveryCountryCode
string
required

Delivery address country code (ISO 3166-1 alpha-2)

Example:

"US"

deliveryIntervalCount
integer<int32>
required

Number of intervals between deliveries. For one delivery per billing period, send the billingIntervalCount value

Required range: x >= 1
Example:

1

deliveryIntervalType
enum<string>
required

Delivery frequency interval type. For one delivery per billing period, send the billingIntervalType value

Available options:
DAY,
WEEK,
MONTH,
YEAR,
$UNKNOWN,
DAY,
WEEK,
MONTH,
YEAR
Example:

"MONTH"

lines
object[]
required

Product line items to include in the subscription

nextBillingDate
string<date-time>
required

Date when the next billing/order will occur

Example:

"2024-02-01T00:00:00Z"

allowDeliveryAddressOverride
boolean
default:false

Allow customer to change delivery address in customer portal

Example:

false

allowDeliveryPriceOverride
boolean
default:false

Allow delivery price to be overridden

Example:

false

createWithoutPaymentMethod
boolean
default:false

If true, creates subscription without payment method. Status will be set to PAUSED unless skipPaymentCreateUnpaidOrder is also true.

Example:

false

currencyCode
string

Currency code for the subscription (ISO 4217). If not provided, uses store default currency

Example:

"USD"

customAttributes
object[]

Custom attributes to attach to the subscription contract

Example:
deliveryAddress2
string

Delivery address line 2

Example:

"Apt 4B"

deliveryFirstName
string

Delivery address first name

Example:

"John"

deliveryLastName
string

Delivery address last name. Required for a US address

Example:

"Doe"

deliveryPhone
string

Delivery phone number

Example:

"+1234567890"

deliveryPriceAmount
number<double>

Fixed delivery price amount in store currency

Example:

5.99

deliveryProvinceCode
string

Delivery address state or province code, such as NY for New York. Required for a US address

Example:

"NY"

deliveryZip
string

Delivery address ZIP or postal code. Required for a US address. A 4-digit US ZIP code gets a leading 0: 2134 becomes 02134

Example:

"10001"

locationId
string

Shopify location ID used for local pickup. Required when methodType is PICK_UP

Example:

"gid://shopify/Location/123456789"

maxCycles
integer<int32>

Maximum number of billing cycles. Null for unlimited

Required range: x >= 1
Example:

12

methodType
enum<string>
default:SHIPPING

Delivery method. LOCAL requires deliveryPhone, PICK_UP requires locationId

Available options:
SHIPPING,
LOCAL,
PICK_UP
Example:

"SHIPPING"

minCycles
integer<int32>

Minimum number of billing cycles required before cancellation is allowed

Required range: x >= 1
Example:

3

paymentMethodId
string

Customer payment method ID. If omitted, the customer's only payment method is used: a customer with none or with more than one returns a 400. Not used when createWithoutPaymentMethod is true.

Example:

"gid://shopify/CustomerPaymentMethod/abc123"

skipPaymentCreateUnpaidOrder
boolean
default:false

If true, billing attempts on this contract will create unpaid orders instead of failing when no payment method is present. Requires createWithoutPaymentMethod=true. Contract will be created as ACTIVE (not PAUSED) so billing can proceed.

Example:

false

status
enum<string>
default:PAUSED

Initial status of the subscription contract. If omitted, the contract is created PAUSED. Ignored when createWithoutPaymentMethod is true.

Available options:
ACTIVE,
PAUSED,
CANCELLED,
EXPIRED,
FAILED,
$UNKNOWN,
ACTIVE,
PAUSED,
CANCELLED,
EXPIRED,
FAILED
Example:

"ACTIVE"

Response

Subscription contract created. The example is trimmed

billingAttempts
object
billingPolicy
object
createdAt
object
customAttributes
object[]
customer
object
customerPaymentMethod
object
deliveryMethod
object
deliveryPolicy
object
deliveryPrice
object
discounts
object
get__typename
string
id
string
lastPaymentStatus
enum<string>
Available options:
SUCCEEDED,
FAILED,
$UNKNOWN
lines
object
nextBillingDate
object
note
string
originOrder
object
revisionId
object
status
enum<string>
Available options:
ACTIVE,
PAUSED,
CANCELLED,
EXPIRED,
FAILED,
$UNKNOWN
updatedAt
object