Create a subscription
/subscriptionsStarts a subscription for a customer with a saved payment method, from catalog prices or prices sent inline. To sign a customer up on a page, use a checkout session in subscription mode or a payment link instead.
Headers
AuthorizationstringRequiredidempotency-keystringA unique key, such as a UUID, that makes a POST safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace. A retry with the same key, endpoint and body gets the first response. Another endpoint or body gets 400 idempotency_error, and a retry while the first is running gets 409.
Parameters
customer_reference_idstringRequireditemsarray of objectsRequiredShow 4 child parametersHide child parameters
pricestringprice_dataobjectA price sent inline. Pay.com finds the product's price by its reference, or without one by currency and schedule. A different unit_amount or tax behavior adds a version, and the same data reuses the current one.
Show 7 child parametersHide child parameters
currencystringRequiredThree-letter ISO currency code, in lowercase.
unit_amountintegerRequiredtax_behaviorstringexclusive adds tax to the amount, and inclusive includes it.
scheduleobjectMakes the price recurring.
Show 2 child parametersHide child parameters
intervalstringRequiredinterval_countintegerreferencestringproductstringA catalog product (prod_). Send this or product_data.
product_dataobjectA product sent inline. Pay.com finds it by reference or creates it, and updates it with what you send (the latest wins).
Show 7 child parametersHide child parameters
referencestringRequirednamestringRequireddescriptionstringimagesarray of stringstax_codestringA tax code (txcd_).
shippablebooleanmetadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
external_pricestringquantityintegerpayment_methodstringA saved payment method. Defaults to the customer's default.
subscription_optionsobjectHow a subscription runs. Taken by checkout sessions in subscription mode, payment links and POST /v1/subscriptions, and by nothing on the main API. Your tax figures travel in tax_options, not here.
Show 9 child parametersHide child parameters
enginestringpay_com, stripe for Stripe Billing, external for your own system or shop plugin, or the engine of one of your connections. Defaults to the price's, then your settings', then pay_com.
connectionstringThe connection (subconn_), when you have more than one for the engine.
referencestringYour ID for the subscription, unique in your workspace and environment.
trialobjectShow 5 child parametersHide child parameters
intervalstringinterval_countintegerend_atstringpayment_method_requiredbooleanmissing_payment_methodstringcycle_anchorstringThe first full renewal date.
cancel_atstringexternalobjectThe IDs that already exist at an external engine.
Show 2 child parametersHide child parameters
customerstringsubscriptionstringtax_figuresstringWhen you sell with your own tax figures: stored charges each renewal with the figures you sent, per_invoice asks for each renewal's with invoice.drafted.
metadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
tax_optionsobjectHow tax is worked out, as on the main API's charges. Send your own figures with tax_quote_data.tax_breakdown, a tax_quote you created, or a tax_configuration for Pay.com to calculate on your tax setup. Without it, Pay.com uses your default tax configuration, or charges no tax if you have none.
Show 3 child parametersHide child parameters
tax_configurationstringtax_quotestringtax_quote_dataobjectThe same object the main API's tax_options.tax_quote_data takes.
seller_of_recordobjectOverrides your seller rules for this sale, among the sellers your account is approved for.
Show 1 child parameterHide child parameters
typestringmetadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
Returns
The subscription.
idstringresourcestringversionintegerGoes up by one with every change. Events carry it, so you can skip one older than one you've processed.
statusstringcustomerstringcustomer_reference_idstringreferencestring or nullitemsarray of objectsShow 5 child attributesHide child attributes
idstringThe item (subitem_).
pricestringprice_versionintegerThe version it was sold at.
productstringquantityintegerShow 24 more attributesShow fewer attributes
currencystringThree-letter ISO currency code, in lowercase.
current_period_startstringcurrent_period_endstringtrial_endstring or nullcancel_atstring or nullcanceled_atstring or nullcancellation_reasonstring or nullpayment_methodstring or nullseller_of_recordobjectWho sells: you, or Pay.com as merchant of record. Fixed when the customer pays, and never changed on renewal.
Show 2 child attributesHide child attributes
typestringpay_com comes with merchant of record.
entitystringThe selling legal entity (ent_).
engineobjectShow 5 child attributesHide child attributes
typestringconnectionstring or nullcollection_modelstringexternalobject or nullShow 3 child attributesHide child attributes
customerstringsubscriptionstringstatusstringsyncobjectShow 2 child attributesHide child attributes
statusstringlast_synced_atstring or nullresponsibilitiesobjectWho owns each job. Exactly one owner each, so it's always clear which system charged a customer.
Show 5 child attributesHide child attributes
schedulerstringcollectorstringdunningstringinvoice_issuerstringtaxstringprocessorobjectWhere the subscription's payments are processed. It stays within the seller: Pay.com sells only on accounts it controls.
Show 4 child attributesHide child attributes
servicestringacquiring for Pay.com Acquiring, orchestration for one of your own processors.
account_ownerstringsettlement_accountstring or nullYour settlement account the payments go to. null when Pay.com sells.
providerstring or nullYour processor, with orchestration. Otherwise null.
accessobjectAccess is separate from payment status.
Show 2 child attributesHide child attributes
statusstringends_atstring or nullnext_paymentobject or nullShow 4 child attributesHide child attributes
amountintegercurrencystringdue_onstringcancel_byobjectCanceling before at stops this charge. Show last_day in time_zone. Never work a date out on the screen.
Show 3 child attributesHide child attributes
atstringlast_daystringtime_zonestringprice_changeobject or nullShow 5 child attributesHide child attributes
pricestringversionintegeramountintegercurrencystringdue_onstringlatest_invoiceobject or nullShow 5 child attributesHide child attributes
idstring or nullexternal_idstring or nullnumberstring or nullstatusstringissuerstringwithdrawal_ends_atstring or nullwithdrawal_chargeobject or nullShow 3 child attributesHide child attributes
amountintegercurrencystringstatusstringrefund_due_bystring or nulllast_failureobject or nullShow 2 child attributesHide child attributes
categorystringretryablebooleanstore_linkobject or nullShow 2 child attributesHide child attributes
Option 1objectStore tokens and tap time for a purchase linked out from an app.
Show 3 child attributesHide child attributes
platformstringtokensarray of objectsShow 2 child attributesHide child attributes
typestringvaluestringtapped_atstringOption 2nullmetadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
createdstringtest_modebooleanErrors
400401403404409422amount_mismatch: amount doesn't equal the line items' total.
- price_inactive, product_inactive: an item can't be sold.
- currency_mismatch: the items or rates use different currencies.
- no_shipping_rate: an item ships and no active rate covers the session's currency.
- checkout_not_open: the session is completed or expired.
- order_not_refundable: the order is fully refunded, or under a dispute.
- amount_exceeds_refundable: more than what's left to refund.
- quantity_exceeds_refundable: more of an item than was sold and not yet refunded.
- order_not_shippable: shipped_at was sent for an order with nothing that ships.
- shipping_rate_inactive: a rate in shipping_options is archived.
- tax_exceeds_amount: inclusive tax figures are more than an item's amount.
- refund_failed: the payment method refused the refund. Nothing was refunded.
- custom_css_not_approved: the draft's changed custom CSS isn't approved yet.
- default_profile: your default design profile can't be archived.
- profile_not_published: the design profile has nothing published yet, so sessions and links can't use it and it can't be your default.
- profile_archived: the design profile is archived, so new sessions and links can't use it and it can't be your default.
- display_name_required: the draft to publish has no display_name.
- low_contrast: white text on colors.accent, or colors.text on colors.background, is under 4.5:1.
- number_in_use: the next number is one the series has already used.
- tax_rate_required: a subscription sent with your own tax figures has a tax_breakdown entry without a percentage_decimal or a flat_amount, so it can't be applied to renewals.
- seller_engine_conflict: the request names an external engine for a sale that can resolve to Pay.com as seller.
- engine_not_allowed_for_seller: the engine can't run a subscription this seller sells.
- processor_not_allowed_for_seller: Pay.com sells only on accounts it controls, and the processor isn't one of them.
- engine_capability_missing: the engine or its connection can't do what the request needs.
- connection_not_ready: the engine's connection isn't connected, or needs action.
- product_refused: a product failed review for merchant of record, and you can't sell it yourself in this request.
Subscription and seller refusals come at creation, never at renewal.