Create subscription

Create a new subscription.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

Create a new subscription for a customer. Associate them with a plan and optionally apply a coupon or trial period.

Example: A customer selects your Premium Annual plan. Create a subscription with their user_id, plan_id, and source_id to start billing immediately.


Conditional Requirements

ConditionRequired Fields
Alwaysplan_id OR plan_old_provider_id
Alwaysuser_id OR customer_old_provider_id
collection_method=charge_automatically (default)source_id OR source_old_provider_id
collection_method=send_invoicesource_id is optional
Account has taxes_enabled=trueaddress_id OR address_old_provider_id required for tax calculation (subscription created without taxes if missing)
Plan's product has address_required=true AND customer has no shipping addressaddress_id required
Plan's product has address_required=true AND customer has shipping addressaddress_id OR address_old_provider_id
is_gift_donor=truegift_recipient_email, gift_recipient_first_name, gift_recipient_last_name allowed
gift_donor_old_provider_id OR gift_donor_subscription_id is setCannot use is_gift_donor (mutually exclusive)
current_period_end is setCannot use trial_period_days (mutually exclusive)
trial_period_days is setCannot use current_period_end (mutually exclusive)
next_invoice_date is setcurrent_period_end must also be set and have same value
start_date is set in the futurebilling_behavior is required (bill_immediately or bill_on_start_date)
Both user_id AND customer_old_provider_id are setMust reference the same customer
Both address_id AND address_old_provider_id are setMust reference the same address
Both plan_id AND plan_old_provider_id are setMust reference the same plan
Both source_id AND source_old_provider_id are setMust reference the same source
Customer has reached max subscription limitRequest will fail

Webhook

Triggers the subscription.created webhook event.

Query Params
int32
required

The unique identifier of the site associated with your account.

Body Params
int32

Customer user ID. Required unless customer_old_provider_id is provided.

int32

Plan ID. Required unless plan_old_provider_id is provided.

int32

Shipping address ID. Required when the plan product has address_required enabled.

int32

Payment source ID. Required when collection_method is charge_automatically.

boolean

A boolean that determines whether the subscription will auto-renew or not at the end of the last phase. (overrides the plan configuration when set)

string
length ≤ 191

The campaign associated to the subscription. If the key does not already exist, it will be created. The campaign key must be between 3 and 191 characters in length and include only letters, numbers, dashes and underscores without space.

string
enum
Defaults to charge_automatically

Payment collection method. Defaults to charge_automatically.

Allowed:
string

Coupon code to apply to the subscription.

int32

A valid Unix timestamp in the future representing the exact time at which the subscription will either renew or cancel, based on the auto-renewal behavior.

domains
array of strings

Email domains that will allow end-users with these domains to be members of this subscription upon registration/login. It can only be sent when the subscription plan type is membership.

domains
metadata
array of objects

Set of key-value pairs that can be saved on subscription level. This can be useful for storing additional information about the object in a structured format.

metadata
int32
required
1 to 100000

Subscription quantity (1–100,000).

int32

An integer indicating the number of shipments remaining for the subscription.

boolean

Whether shipments for this subscription are undeliverable.

int32

A valid Unix timestamp in the future to set the exact time until the subscription's shipments should be suspended.

string
required
length ≤ 255

Acquisition source label (e.g. api, web, phone). Free text, max 255 characters.

int32
≤ 730

Trial period in days (0–730). Mutually exclusive with current_period_end.

boolean

Whether the subscription is imported from another system.

boolean

Create as a gift donor subscription. Mutually exclusive with gift_donor_subscription_id. Requires gift_recipient_email, gift_recipient_first_name, gift_recipient_last_name.

ip_addresses
array of strings

IP addresses that will identify end-users as members of this subscription upon registration/login. This attribute can only be set when the subscription plan type is membership. Two format are accepted for strings:

A single public IP address
This should be a valid public IP address following the standard IPv4 format (e.g., 192.168.1.100).

A range of public IP addresses
This should be a range of public IP addresses following the CIDR notation (e.g., 198.51.100.0/24).

You can use this tool calculate the appropriate CIDR notation for your needs.

ip_addresses
date

Gift start date in YYYY-MM-DD format. Must be within one year. Only when is_gift_donor is true.

string
length ≤ 255

Gift recipient email address. Required when is_gift_donor is true.

string
length ≤ 255

Gift recipient first name. Required when is_gift_donor is true.

string
length ≤ 255

Gift recipient last name. Required when is_gift_donor is true.

string
length ≤ 200

Gift message included with the gift notification (max 200 characters). Only when is_gift_donor is true.

int32

Donor subscription ID when creating a gift recipient subscription. Mutually exclusive with is_gift_donor.

string
length ≤ 191

External provider ID for imported subscriptions. Must be unique per account. Max 191 characters.

string
length ≤ 191

Import alias for gift_donor_subscription_id. Resolves by old_provider_id on the donor subscription. Max 191 characters.

integer

Unix timestamp for next invoice date. Must equal current_period_end. Prohibited when current_period_end is not set.

string
length ≤ 255

Import alias for user_id. Resolves by old_provider_id on the customer.

string
length ≤ 255

Import alias for address_id. Resolves by old_provider_id on the address.

string
length ≤ 255

Import alias for plan_id. Resolves by import_unique_id on the plan.

int64

Unix timestamp for subscription start date. When set in the future, subscription starts as scheduled. Pelcro Billing Engine accounts only.

string | null
enum

Billing behavior when start_date is in the future. Required when start_date is a future date.

Allowed:
string | null

Import alias for source_id. Resolves to source_id by matching old_provider_id on the payment source. Use this instead of source_id when importing from another system.

integer | null
integer | null
≥ 0

Tip amount for vendor-associated subscriptions. Minimum 0.

Headers
string
required
Defaults to Bearer eyJ***
Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json