Create a subscription
Starts a subscription for a customer without a cart or invoice. The customer must already have a saved payment method.
Secret tokens only. A limited token cannot create subscriptions.
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
customer_id*stringThe id of the customer. With a limited token from a customer login you can send me instead.
expand?stringComma-separated child objects to return in full instead of as a URL, for example customer,payments. Use dot notation for nested objects (items.product), up to four levels deep. A single object takes up to 12 paths; a list takes up to 2, applied to every item. Extra paths are dropped without an error. See Expanding objects.
show?stringComma-separated fields to return; all others are left out. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.
hide?stringComma-separated fields to leave out of the response. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.
formatted?booleanWhen true, the object also has a formatted child with amounts and dates as display text in the shopper's language and currency (for example $19.99 or November 7, 2026). The default is false. See Localized formatting.
falseapplication/json- body
A new subscription for an existing customer. The customer must have a saved payment method. Billing interval, trial and number of billings come from the subscription plan.
subscription_plan_id*stringThe subscription plan to follow.
currency?stringThe three-letter ISO 4217 currency the customer pays in. Must be a currency your account takes. Defaults to your default payment currency.
3 <= length <= 3items*array<>The items to bill for. Product ids must be unique. On a reseller account every item needs a product_id.
1 <= itemsshipping_method_id?stringThe shipping method for physical items. Only allowed when every item has a product_id. If you leave it out and an item is physical, the first shipping method for the customer's country is used.
affiliate_id?stringAn affiliate to credit for the subscription.
length <= 75meta?unknownAny data you want to store on the subscription, up to 2,048 characters.
The new subscription.
application/json- response
A customer's recurring billing for one or more items. Most subscriptions are made when a cart or invoice with a subscription product is paid. Each billing period an invoice is made and paid from the customer's saved payment method.
object*"subscription"The object type. Always subscription.
"subscription"url*stringThe full URL of this subscription.
urisubscription_id*stringThe subscription id.
date_created*stringWhen the subscription was created.
date-timedate_modified*stringWhen the subscription was last changed.
date-timetest*booleantrue for a test subscription, false for a live one.
account_id*stringThe account the subscription belongs to.
status*stringtrial while in a free trial, active while billing, cancelled once cancelled, and completed once the last billing set by end_at_billing_count is done.
"trial""active""cancelled""completed"in_grace_period*booleantrue when a renewal payment failed and is being retried. The subscription stays active during the grace period. If no retry succeeds before the grace period in your subscription settings ends, the subscription is cancelled.
billing_interval*integerHow many billing_interval_unit make one billing period. Copied from the subscription plan when the subscription was made.
billing_interval_unit*stringThe unit of the billing period. minute and hour are only allowed on test plans.
"minute""hour""day""month""year"billing_interval_description*stringThe billing period as text, for example 1 month or 3 months.
trial_interval*|The trial length in trial_interval_unit. null when there is no trial.
trial_interval_unit*|The unit of the trial. null when there is no trial.
"minute""hour""day""month""year"nulltrial_interval_description*|The trial length as text, for example 14 days. null when there is no trial.
billing_count*integerHow many times the subscription has been billed (one invoice per billing period). This is not the number of successful payments: a failed renewal still counts. 0 during a trial.
end_at_billing_count*|The number of billings after which the subscription completes. null means it bills until cancelled.
currency*stringThe three-letter ISO 4217 currency the customer pays in. Item prices in another currency are converted at each renewal.
items*array<>The items the subscription bills for, including cancelled ones.
shipping_method_id*|The shipping method used for physical items on each renewal. null when nothing is shipped.
date_trial_start*|When the trial started. null when there is no trial.
date-timedate_trial_end*|When the trial ends, or ended. null when there is no trial.
date-timedate_current_period_start*|When the current billing period started. null once the subscription is cancelled.
date-timedate_current_period_end*|When the current billing period ends. The next renewal is billed at this time. null once the subscription is cancelled.
date-timedate_next_renewal_notification?|When the next renewal reminder is sent to the customer. null when reminders are off or none is due. Not returned to a limited token.
date-timedate_cancelled*|When the cancellation was asked for. When a cancellation is scheduled for the period end, this is set at once while the subscription stays active until date_current_period_end. null when not cancelled.
date-timecancellation_reason?|Why the subscription was cancelled: the reason sent with the cancellation, or one set automatically (for example when all items were cancelled). Not returned to a limited token.
cancel_at_current_period_end*booleantrue when the subscription is set to be cancelled at the end of the current billing period.
date_ended*|When the subscription ended, by cancellation or completion. For an immediate cancellation it equals date_cancelled. null while the subscription runs.
date-timeadd_at_current_period_end*array<>Items scheduled to be added at the end of the current billing period. Empty when none are scheduled. Remove them all with DELETE /subscriptions/{subscription_id}/add_at_current_period_end.
subscription_plan?|The subscription plan, as a URL, or the full object with expand=subscription_plan. Later changes to the plan do not change existing subscriptions, so the plan can differ from the values here. Left out when the token may not read subscription plans.
customer?|The customer, as a URL, or the full object with expand=customer. Left out when the token may not read customers.
invoices?|The subscription's invoices, as a URL, or an offset-based list of invoices with expand=invoices (only when you get one subscription, not in a list). The invoices are the billing history. Left out when the token may not read invoices.
history?|The change log, as a URL, or the full object with expand=history (only when you get one subscription). Not returned to a limited token.
meta*unknownAny data you stored on the subscription, up to 2,048 characters.
formatted?The dates as display text in the requested locale and time zone. Only returned with formatted=true.
curl -X POST 'https://api.comecero.com/api/v1/customers/string/subscriptions' \ -H 'Content-Type: application/json' \ -d '{ "subscription_plan_id": "0093472113202Spzs4AV8C", "currency": "USD", "items": [ { "product_id": "widget-pro.test", "quantity": 1 } ]}'{ "object": "subscription", "url": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8", "subscription_id": "0093799318129SuLByRPW8", "date_created": "2026-10-02T15:21:28Z", "date_modified": "2026-11-02T15:21:31Z", "test": true, "account_id": "AB1234", "status": "active", "in_grace_period": false, "billing_interval": 1, "billing_interval_unit": "month", "billing_interval_description": "1 month", "trial_interval": null, "trial_interval_unit": null, "trial_interval_description": null, "billing_count": 2, "end_at_billing_count": null, "currency": "USD", "items": [ { "object": "subscription_item", "url": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8/items/acme-pro.test", "item_id": "acme-pro.test", "date_created": "2026-10-02T15:21:28Z", "date_modified": "2026-10-02T15:21:28Z", "product_id": "acme-pro.test", "name": "Acme Pro (monthly)", "quantity": 1, "reference_price": 19.95, "reference_currency": "USD", "reference_discount": 0, "reference_discount_price": null, "discount_apply_count": null, "discount_applied_count": 0, "cancelled": false, "cancel_at_current_period_end": false, "date_cancelled": null, "date_ended": null, "cancellation_reason": null, "tax_code": null, "type": "digital", "change_at_current_period_end": null, "product": "https://api.comecero.com/api/v1/products/acme-pro.test", "subscription": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8", "subscription_terms": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8/items/acme-pro.test/subscription_terms", "meta": null } ], "shipping_method_id": null, "date_trial_start": null, "date_trial_end": null, "date_current_period_start": "2026-11-02T15:21:28Z", "date_current_period_end": "2026-12-02T15:21:28Z", "date_next_renewal_notification": "2026-11-29T15:21:28Z", "date_cancelled": null, "cancellation_reason": null, "cancel_at_current_period_end": false, "date_ended": null, "add_at_current_period_end": [], "subscription_plan": "https://api.comecero.com/api/v1/subscription_plans/0093472113202Spzs4AV8C", "customer": "https://api.comecero.com/api/v1/customers/0093799288003CuGOip8X9", "invoices": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8/invoices", "history": "https://api.comecero.com/api/v1/subscriptions/0093799318129SuLByRPW8/history", "meta": null}