Checkout sessions
Call POST /checkout/sessions from your server with Authorization and Idempotency-Key.
Use one stable key per order or card registration. Reuse the same key/body on HTTP and MCP.
Set the optional locale (for example, "pt-BR" or "sr") in any session or MCP call. Buyer pages support en, zh, hi, es, ar, fr, bn, pt, id, ur, ru, de, ja, pcm, ar-EG, mr, vi, te, sw, ha, sr.
Without locale the browser chooses the initial language. The buyer can switch on the hosted or embedded page.
Website and Dev Center pages, OpenAPI, quickstarts and tool descriptions support the same languages. Use ?lang=sr or Accept-Language: sr for Serbian.
Stripe, Teya and issuer authentication screens use their own supported languages. Each verified API key has its own 500/hour general quota across HTTP and MCP. Honor Retry-After on HTTP 429.
Send one of these bodies. Replace {{person_id}} with an active CRM person in your tenant.
Save the selected body to checkout.json. From the merchant server:
curl --fail-with-body -X POST 'https://chronosfy.com/api/checkout/sessions' -H "Authorization: $AUTH" -H 'Content-Type: application/json' -H 'Idempotency-Key: order-42-v1' --data-binary @checkout.jsonSet AUTH to "ApiKey <key>" or "Bearer <token>". Keep it on the server. For status, replace SESSION_ID:
curl --fail-with-body 'https://chronosfy.com/api/checkout/sessions/SESSION_ID' -H "Authorization: $AUTH"Pay once (amount in minor units; payments:links)
{
"mode": "payment",
"amount": 2990,
"currency": "GBP",
"description": "Order 42",
"client_reference_id": "order-42",
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/orders/42"
}Authorize a recurring charge (financial_recurrences:write and payments:setup)
{
"mode": "recurring",
"locale": "en",
"amount": 9900,
"currency": "GBP",
"description": "Monthly membership",
"person_id": "{{person_id}}",
"recurrence": {
"frequency": "monthly",
"timezone": "Europe/London",
"first_payment": {
"timing": "after_days",
"days": 7
}
},
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/membership"
}Use {"timing":"immediate"} to collect cycle one in checkout (also needs payments:links).
Use {"timing":"after_days","days":7} for 1–400 calendar days from buyer consent or {"timing":"at","at":"..."} for a future ISO timestamp within 400 days.
Frequency is daily, weekly or monthly. Renewals keep the local calendar anchor, shortening to the last day in shorter months.
The buyer sees the price and first date before agreeing. Only server-confirmed completion activates the schedule.
Track recurrence_id with GET /recurrences/{id} after completion. Cancel with DELETE /recurrences/{id}.
initial_payment_paid records a confirmed initial checkout charge. Deferred enrollment completes with no money collected.
Aging links never start unsolicited renewals. For changed terms, cancel the original and obtain fresh consent.
Teya recurring requires transactions/online/create and transactions/online/id/get. A definitive temporary Teya decline is rechecked before retry at 24h and then 72h (3 attempts maximum). Ambiguous dispatch with no reference requires review.
Save at the provider, without a purchase (payments:setup)
{
"mode": "setup",
"storage": "provider",
"person_id": "{{person_id}}",
"currency": "GBP",
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/cards"
}Save in the tenant vault, without a provider (vault:write)
{
"mode": "setup",
"storage": "tenant_vault",
"person_id": "{{person_id}}",
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/cards"
}Stripe and Teya accept provider selection ("stripe" or "teya"); otherwise the tenant default is used.
Stone integration awaits selection of the Brazilian product. There is no automatic provider substitution.
return_url must use HTTPS. Set embed_origin to the store's exact HTTPS origin to request embedded checkout.
Treat checkout_url, including its fragment, as a private buyer link. Its initial access window is one hour.
A shopper can open the URL directly. When presentation is embedded, the store can also mount it:
<div id="checkout"></div>
<script src="https://chronosfy.com/api/checkout/sdk.js"></script>
<script>
// session comes from your store backend, which holds the API key.
if (session.presentation === 'embedded') {
const mounted = ChronosfyCheckout.mount('#checkout', session.checkout_url, {
onComplete: () => window.location.assign(session.mode === 'recurring' ? '/membership' : session.mode === 'payment' ? '/orders/42' : '/cards')
});
// In a single-page app call mounted.destroy() when leaving this view.
} else if (session.checkout_url) {
window.location.assign(session.checkout_url);
}
</script>For Stripe embedding configure the store's publishable key. For Teya use store-specific OAuth credentials and its payment webhook public key. A provider returning only a hosted URL uses redirect. Allow the Chronosfy origin in your site's frame-src and script-src, plus the SDK, frames and connections of the configured provider.
GET /settings/payment/webhook-url (owner) exposes webhook_urls.stripe and webhook_urls.teya, even before switching the default.
The tenant vault uses an isolated Chronosfy frame. Keep card data out of merchant scripts, MCP, logs and webhook payloads.
Subscribe to checkout.session.completed, checkout.session.failed, checkout.session.expired and checkout.session.needs_review.
GET /checkout/sessions/{id} requires payments:read. Fulfil only a completed payment. A completed setup means
the card was saved for the indicated person. payment_method_id identifies a Stripe payment method, vault card or Teya registration inside Chronosfy; existing off-session charge tools support Stripe or configured vault paths.
The Teya provider reference is kept encrypted. A return, redirect or SDK callback only signals a browser transition.
The reconciler and provider notifications finish independently of the browser. For Teya setup, deliver payment.succeeded.v1 to https://chronosfy.com/api/checkout/webhooks/teya/{tenant} to associate the verified token.
MCP: call create_checkout_session with the same body plus request_key. Call get_checkout_session with { "id": "..." }.
On conflict (409), check the original body. After a timeout repeat the original request and key.
Use GET for a terminal result; a replay then has checkout_url=null. For existing payment links, keep using /payment/links.
## Refunds
Stripe and Teya support full and partial refunds. Enter the amount in the smallest currency unit. Use a new key for each separate refund and reuse it when retrying. Only succeeded confirms the refund. Refunding a payment leaves future renewals scheduled.
Already refunded by the provider
`already_refunded_externally`
Already refunded by another request
`already_refunded_by_other_request`
curl -X POST "$API/checkout/sessions/$CHECKOUT_ID/refund" \
-H "Authorization: ApiKey $API_KEY" -H "Idempotency-Key: refund:order-42:1" \
-H "Content-Type: application/json" -d '{"amount":2500,"reason":"requested_by_customer"}'
curl "$API/payment/refunds/$REFUND_ID" -H "Authorization: ApiKey $API_KEY"payments:refund POST /checkout/sessions/{id}/refund
payments:refund POST /payment/links/{id}/refund
payments:refund POST /payment/charges/{charge_id}/refund
payments:read GET /payment/refunds/{id}
MCP request_refund, get_refund
Teya refunds/create## Card processing responses
gateway_response gives the Chronosfy operation, status and code. provider_response preserves the original provider fields allowed for merchants, including issuer codes when available. It is null for local storage, a missing reply or older records without a recorded response. Read the result on your server using the checkout ID after the browser returns.
{
"provider_response": {
"provider": "teya",
"body": {
"status": "FAILURE",
"status_reason": "INSUFFICIENT_FUNDS",
"issuer_result": { "response_code": "51" }
}
},
"gateway_response": {
"operation": "charge",
"status": "failed",
"code": "CHARGE_FAILED",
"reason": "insufficient_funds"
}
}## Default payment provider
Saving credentials keeps the default unchanged, even for the first provider. To choose the account for new payments, the tenant owner selects a saved account and confirms the change. An explicit provider can be used before choosing a default.
GET /api/settings/payment
Authorization: Bearer <owner_access_token>
POST /api/auth/reauth
Authorization: Bearer <owner_access_token>
Content-Type: application/json
{"password":"<password>","operation":"PUT /settings/payment/default"}
PUT /api/settings/payment/default
Authorization: Bearer <owner_access_token>
X-Reauth-Token: <reauth_token>
Content-Type: application/json
{"config_id":"<configurations[].config_id>"}MCP: set_default_payment_provider({config_id, reauth_token})