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:
- The session, when it sets one.
- Otherwise the price.
- 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" }
}
}'{
"id": "cs_691224127905239040",
"resource": "checkout_session",
"mode": "subscription",
"status": "open",
"url": "https://checkout.pay.com/a/Yb3nQ7kTm5Rc",
"subscription_options": {
"engine": "stripe",
"reference": "cust-jane-doe-001-annual",
"resolved": {
"engine": "stripe",
"connection": "subconn_691177409318932480",
"collection_model": "directed",
"resolved_from": "session",
"seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" },
"responsibilities": {
"scheduler": "engine",
"collector": "pay_com",
"dunning": "engine",
"invoice_issuer": "engine",
"tax": "engine"
},
"due_now": { "amount": 9900, "currency": "usd" },
"then": { "amount": 9900, "currency": "usd", "interval": "year", "interval_count": 1 }
}
}
}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 works | collection_model | Schedules renewals | Collects payments | Retries failures | Issues the invoice | Calculates tax |
|---|---|---|---|---|---|---|
| Pay.com's engine | native | Pay.com | Pay.com | Pay.com | Pay.com, in the seller's name | Pay.com's tax calculation, or your figures when you sell |
| Stripe Billing, with Pay.com collecting | directed | Stripe Billing | Pay.com, each time Stripe Billing asks | Stripe Billing | Stripe Billing | Stripe Billing |
| An engine with its own collection off | handoff | The engine | Pay.com | Pay.com | The engine | The engine |
| An engine that charges through a Pay.com connector | engine_gateway | The engine | The engine | The engine | The engine | The engine |
| Your own system or shop plugin | merchant_scheduled | You | You, through the API | You | You | You |
| Mirrored (app stores or an engine on its own processor) | mirror | Outside Pay.com | Outside Pay.com | Outside Pay.com | Outside Pay.com | Outside 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.