Saltar al contenido principal
POST
cURL
Create a subscription for a customer. Commet selects the default price when priceId is omitted. The subscription starts at the base USD price; market and currency are resolved from the buyer’s request country when the checkout opens. Without an offer override, Commet applies the price’s automatic introductory Offer. Pass offerId to apply an active compatible Offer directly, or cardPromotionId to preselect a card-eligible Promotional Offer for the initial checkout when card promotions are enabled for the organization. For the initial checkout, provider accepts either a processor name or an exact payment connection ID. When the price’s free trial requires no payment method, the subscription starts trialing right away with no checkout (checkoutUrl null, hasPaymentMethod false); it cannot be combined with offerId, promoCode, cardPromotionId or provider, and an organization that cannot charge yet receives 403. An unpaid checkout follows the latest version of what was requested: the plan’s current version for a plan code, the experiment’s latest version for an experiment code, and that version for planVersionId. Its link charges that version, and repeating the same request returns 200 with the same subscription and checkoutUrl. Another plan, experiment, version, interval or price replaces it. See Unpaid checkouts.

Autorizaciones

x-api-key
string
header
requerido

Encabezados

Idempotency-Key
string

Unique key used to safely retry this write for 24 hours without applying it twice.

Required string length: 1 - 200
Commet-Version
string
predeterminado:2026-08-27

API version used by this reference. Send this header to select this contract explicitly.

Cuerpo

application/json
customerId
string
requerido
Required string length: 1 - 200
planId
string
requerido
Minimum string length: 1
billingInterval
enum<string> | null
Opciones disponibles:
weekly,
monthly,
quarterly,
semiannual,
yearly,
one_time
priceId
string

Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing.

Minimum string length: 1
initialSeats
object
provider

Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present.

Opciones disponibles:
stripe,
commet,
dlocal
paymentMethodTypes
enum<string>[]

Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments.

Minimum array length: 1
Opciones disponibles:
card,
mercado_pago,
oxxo,
google_pay,
smartpix,
apple_pay,
link
name
string
startDate
string<date-time>
successUrl
string<uri>
prepaidPeriods
integer

Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless cancelAtPeriodEnd is true.

Rango requerido: 1 <= x <= 60
cancelAtPeriodEnd
boolean

Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. When the plan's group has a default free plan, it moves to that plan then instead of ending.

planVersionId
string

Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode <plan code>:<experiment code>) sells.

Minimum string length: 1
offerId
any
promoCode
string
Minimum string length: 1
customTrialDays
integer

Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout.

Rango requerido: 0 <= x <= 9007199254740991
skipTrial
boolean
predeterminado:false

Respuesta

Success

id
string
requerido
customerId
string
requerido
plan
object
requerido
name
string
requerido
description
string | null
requerido
status
enum<string>
requerido
Opciones disponibles:
draft,
pending_payment,
trialing,
active,
past_due,
paused,
canceled
billingInterval
enum<string> | null
requerido
Opciones disponibles:
weekly,
monthly,
quarterly,
semiannual,
yearly,
one_time
trialEndsAt
string<date-time> | null
requerido
currentPeriod
object | null
requerido
cancellation
object | null
requerido
cancelAtPeriodEnd
boolean
requerido
scheduledPlanChange
object | null
requerido
startDate
string<date-time>
requerido
endDate
string<date-time> | null
requerido
billingDayOfMonth
integer | null
requerido
Rango requerido: -9007199254740991 <= x <= 9007199254740991
nextBillingDate
string<date-time> | null
requerido
checkoutUrl
string | null
requerido
hasPaymentMethod
boolean
requerido

Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false.

createdAt
string<date-time>
requerido
updatedAt
string<date-time>
requerido
planVersion
object | null
requerido

The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved.

offerApplications
object[]
requerido
pause
object
requerido
checkoutProvider
enum<string> | null
requerido

Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes.

Opciones disponibles:
stripe,
commet,
dlocal
priceId
string | null
requerido
object
string
requerido
Allowed value: "subscription"
livemode
boolean
requerido