Create subscription

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

Create a subscription (and optionally customer). Payment information can be obtained in one of the following ways:

  • A reference to an existing payment method for the customer can be given.
  • A reference to a customer payment method obtained with Frisbii Billing and Pay Checkout
  • Let the system send a signup receipt email to the customer with link to hosted payment information page for the subscription.
  • Handle the gathering of payment information self, e.g. by using the link to the hosted payment information page.

The parameter start_date is optional and indicates when the subscription is eligible to begin the first billing period. Whether the first billing period i starting at start_date depends on the schedule type on the plan for the subscription. If a fixed day schedule type is used, the first billing period will start on the first fixed day after start_date.

A subscription creation can be made conditional on a successful payment of the first invoice. See the parameter conditional_create. This will require a signup method of source, and the subscription must be eligible for billing for the first period right away.

When creating a subscription either a reference to an existing customer must be provided, or a customer can be created in the same operation using the parameter create_customer. The operation is atomic, so if subscription create fails, no customer will be created.

An example of how to use the create subscription API operation can be fore here.

To add subscription add-ons when creating a list of CreateSubscriptionAddOn objects can be provided in parameter add_ons. An example on the use of add-ons can be found here.

Additional costs can be added to a subscription at creation time by providing a list of CreateSubscriptionAdditionalCost objects in parameter additional_costs.

Errors

The operation can generate the following errors beside the generic HTTP error codes described here.

Error code HTTP codeDescription
9404Customer not found
10404Subscription plan provided not found
11400Duplicate handle - subscription handle, additional cost handle or subscription add-on handle already used
14400End date must be in the future
19404Customer card provided as source but cannot be found
34400Invalid card token provided as source
37 400Start date if provided cannot be more than one period in the past, e.g. one month.
75400Subscription not eligible for invoice. This error is returned if the conditional_create parameter is set to true, but the subscription does not have a plan resulting in an invoice right away. This is the case for subscription plans with fixed day billing. E.g. on the first of every month.
83404 Discount not found
85 400Multiple discounts not allowed
86404Coupon not found or not eligible
87400Coupon already used
103400Card token already used
104400Card token has expired
110400Unknown or missing source argument
111400Source not allowed for signup method
113404Add-on not found
114400Add-on already added or multiple occurrences of same add-on in request without explicit unique subscription add-on handle
115 400 Add-on quantity not allowed for on-off add-on type
116400Add-on not eligible for subscription plan
169404Entitlement not found
Body Params
string

Customer handle of existing customer. Customer can also be provided in same operation by supplying the parameter create_customer.

string
required

Plan handle

int32
≥ 0

Optional custom per quantity plan price. If provided the plan price billed for each billing period will be overridden by this price.

int32
≥ 1

Optional quantity of the plan product for this subscription. If not provided the default is the default plan quantity defined for the plan.

boolean

Test flag. If given it will be verified that the account state matches the intended create state.

string

Per account unique handle for the subscription. Max length 255 with allowable characters [a-zA-Z0-9_.-@]. Must be provided if generate_handle not defined.

metadata
object

Custom metadata.

string

The payment method source if signup method source. Either an existing payment method for the customer, e.g. existing card id ca_... or a card token ct_....

create_customer
object

Create customer object

int32
≥ 1

Optional plan version, default is to use newest version of plan

boolean

Whether the optional amount is including VAT. Defaults to true.

boolean

Auto generate handle on the form sub-[sequence_number]

string

Date and time on the form yyyy-MM-dd, yyyyMMdd, yyyy-MM-ddTHH:mm and yyyy-MM-ddTHH:mm:ss from which the subscription is eligible to schedule first invoice. If no time part is given start of day will be used. A start date in the past can be used, but no more than one period length in the past. A start date in the past can result in an instant invoice for a past billing period start. Default value is current date and time.

string

Fixed date and time on the form yyyy-MM-dd, yyyyMMdd, yyyy-MM-ddTHH:mm and yyyy-MM-ddTHH:mm:ss where the subscription will automatically cancel. The subscription will expire at the end of the billing period containing the end date. Default is no fixed end date.

int64
≥ 0

A grace duration in seconds from the creation of a subscription where no dunning process is started for a failing invoice. This allows a certain amount of time for the customer to sign up with a payment method.

boolean

Override plan trial settings and disable trial

boolean

Override plan setup fee settings and disable fee

string

Optional custom trial period overriding the setting on the subscription plan. Defined in ISO 8601 duration. See https://en.wikipedia.org/wiki/ISO_8601#Durations. E.g. P7D for seven days or P1M for one month.

subscription_discounts
array of objects
length between 0 and 100

Discounts to attach to subscription. A maximum of 100 discounts is allowed.

subscription_discounts
coupon_codes
array of strings

Coupon codes to redeem for subscription

coupon_codes
add_ons
array of objects
length between 0 and 100

Add-ons to attach to subscription. The same add-on can only be attached to subscription once unless unique handles are supplied for the subscription add-on. A maximum of 100 add-ons is allowed.

add_ons
additional_costs
array of objects
length between 0 and 100

Additional costs to add to subscription at creation time. A maximum of 100 additional costs is allowed.

additional_costs
additional_entitlements
array of strings

Additional entitlements to add to subscription at creation time.

additional_entitlements
excluded_entitlements
array of strings

Entitlements to exclude from subscription at creation time.

excluded_entitlements
metered_billing_products
array of objects

Usage-based billing products to attach to subscription.

metered_billing_products
string

Date and time on the form yyyy-MM-dd, yyyyMMdd, yyyy-MM-ddTHH:mm and yyyy-MM-ddTHH:mm:ss which represents the earliest possible cancellation date

int32
0 to 12000

Optional number of notice periods for a cancel. The subscription will be cancelled for this number of full periods before expiring. Either from the cancellation date, or from the end of the the current period. See notice_periods_after_current. The default is to expire at the end of current period (0). A value of 1 (and notice_periods_after_current set to true) will for example result in a scenario where the subscription is cancelled until the end of current period, and then for the full subsequent period before expiring.

string
enum

Time unit used in conjunction with notice periods

Allowed:
string

Contract start date for the subscription

string

Contract period end date for the subscription

int32
0 to 12000

Contract period after renewal for the subscription.

string
enum

Time unit used in conjunction with contract period after renewal.

Allowed:
string

Cost center for accounting invoices, will be applied to all future invoices on this subscription

string

Purchase order number for accounting invoices, will be applied to all future invoices on this subscription

string
required

The signup method, how to get payment information from customer, one of the following: source, email, link. The source method takes a reference to an existing customer payment method (e.g. card ca_..) or a card token for ct_.... The method email will send an email to customer requesting payment information with a link to a hosted page. The method link does not do anything but the hosted page link in the subscription object can be provided to the customer as a link to enter payment information.

boolean

Whether to show Terms of Service on the checkout page. Only applicable for signup methods email and link. Default is true.

Responses

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