Skip to Content
Docs

Choose a subscription engine

Pick Pay.com's engine or an external engine for a session, a price, or your whole account, with one subscription_options object.

Keep the subscription engine you already run, or use Pay.com's, without changing how your checkout, entitlements, or reports work. You can even run both, and pick the engine for each price or each session.

One option, resolved in order

Pass one subscription_options object on the Commerce routes that start a subscription: checkout sessions in subscription mode, payment links, and subscriptions. Payment sessions, setup sessions, charges, and holds don't take it. Pay.com resolves the engine in this order:

  1. The session, when it sets one.
  2. Otherwise the price.
  3. Otherwise your account.

When none of them sets one, Pay.com's engine runs the subscription. Set your account's default with PATCH /v1/subscription_settings, and a price's default in the price's subscription_options. The engine is locked when the customer confirms.

This session picks Stripe Billing for a price you've mapped to a Stripe Billing price in the Commerce tab. The response shows the result in subscription_options.resolved, with resolved_from naming where the engine came from. Amounts are in the smallest currency unit, so 9900 is $99.00 USD.

curl https://api.sandbox.pay.com/v1/checkout \
  -u ':sk-pay-com-sandbox-…' \
  -H "Content-Type: application/json" \
  -H "idempotency-key: $(uuidgen)" \
  -d '{
    "mode": "subscription",
    "customer_reference_id": "cust-jane-doe-001",
    "line_items": [{ "price": "prc_691180278147072000", "quantity": 1 }],
    "subscription_options": {
      "engine": "stripe",
      "reference": "cust-jane-doe-001-annual",
      "external": { "customer": "cus_R4tLm8NqVx2pKd" }
    }
  }'

See Subscription options for the routes that take the object, and Create a subscription in the Commerce API reference for every field.

One owner for each job

Each supported way of working with an engine has exactly one owner for each job, so it's always clear which system charged a customer. The subscription's engine.collection_model names the way, and responsibilities names the owners:

How it workscollection_modelSchedules renewalsCollects paymentsRetries failuresIssues the invoiceCalculates tax
Pay.com's enginenativePay.comPay.comPay.comPay.com, in the seller's namePay.com's tax calculation, or your figures when you sell
Stripe Billing, with Pay.com collectingdirectedStripe BillingPay.com, each time Stripe Billing asksStripe BillingStripe BillingStripe Billing
An engine with its own collection offhandoffThe enginePay.comPay.comThe engineThe engine
An engine that charges through a Pay.com connectorengine_gatewayThe engineThe engineThe engineThe engineThe engine
Your own system or shop pluginmerchant_scheduledYouYou, through the APIYouYouYou
Mirrored (app stores or an engine on its own processor)mirrorOutside Pay.comOutside Pay.comOutside Pay.comOutside Pay.comOutside Pay.com

A subscription never has two collectors. An engine's own automatic collection can't run alongside Pay.com's, and Pay.com never retries a charge another system retries. When you charge from your own system, Pay.com never retries.

With your own system, set engine to external. Collect each payment with POST /v1/subscriptions/{subscription_id}/payments, with your invoice's ID in external_invoice, so the payment is tied to its subscription. Charges and holds don't take a subscription.

An engine that collects payments on its own hosted pages is mirrored. It only sends Pay.com its events, which keep entitlements and reports up to date.

External engines

External engines, such as Stripe Billing, connect through an adapter. You connect an engine's account in the Commerce tab, and the API reads it as a subscription connection, with its collection_model, its status, and the result of its collection safety check. Pay.com sends subscription_connection.action_required when a connection needs your attention.

When Pay.com and an engine disagree about a subscription, Pay.com sends subscription.engine_sync.failed, then subscription.engine_sync.restored once they agree again. The engine's own status stays in engine.external.status.

A subscription mirrored from an external engine counts once in your reports, never twice. See Insights and metrics.

When Pay.com sells

When Pay.com sells as the merchant of record, Pay.com's engine runs the subscription. An external engine runs one only where Pay.com still collects the payment, calculates the tax, and issues the only invoice. A request that names an external engine for a sale that can resolve to Pay.com as the seller returns 422 with seller_engine_conflict. Seller and engine refusals like this one come when the subscription is created, never at a renewal.

Entitlements stay the same

Whichever engine runs a subscription, you check what the customer can use through entitlements in the same way.

Was this page helpful?