结帐会议
从你的服务器调用 POST /checkout/sessions,并发送 Authorization 和 Idempotency-Key 请求头。
每个订单或卡片注册使用一个稳定密钥,在HTTP和MCP上重复使用相同的密钥/身体。
在任何会话或 MCP 调用中设置可选的区域设置(例如 "pt-BR" 或 "sr " ) 。 买家页面支持 en, zh, hi, es, ar, fr, bn, pt, id, ur, ru, de, ja, pcm, ar-EG, mr, vi, te, sw, ha, sr。
没有locale,浏览器会选择初始语言。 买家可以切换到托管或嵌入式页面。
网站和开发中心页面、OpenAPI、快速入门和工具描述支持相同的语言。对于塞尔维亚语,请使用?lang=sr 或 Accept-Language: sr 。
Stripe、Teya 和发卡机构的身份验证页面使用各自支持的语言。 每个经过验证的 API 密钥都有独立的一般请求配额,HTTP 和 MCP 合计每小时 500 次。 收到 HTTP 429 时,请等待 Retry-After 指定的时间后再重试。
发送其中一个身份。 将 {{person_id}} 替换为租户中的活动 CRM 人员。
将所选正文保存到 checkout.json。 从商家服务器:
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.json将 AUTH 设置为 "ApiKey <key>" 或 "Bearer <token> " , 在服务器上保留它。 对于 status,替换 SESSION_ID:
curl --fail-with-body 'https://chronosfy.com/api/checkout/sessions/SESSION_ID' -H "Authorization: $AUTH"一次性付款(以小单位计算的金额;付款:链接)
{
"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"
}授权经常性收费(financial_recurrences:write 和 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"
}若要在结账时收取首个周期的费用,请使用 {"timing":"immediate"}。这还需要 payments:links 权限。
使用 {"timing":"after_days","days":7},在买家同意后持续 1–400 个日历日,或使用 {"timing":"at","at":"..."},在未来的 ISO 时间戳内,且在 400 天之内。
可选择每天、每周或每月续费。续费遵循当地日历。如果某个月没有预定的日期,则使用该月的最后一天。
买家在同意前可以看到价格和首次扣款日期。只有服务器确认流程已完成,扣款计划才会生效。
轨道 recurrence_id 与 GET /recurrences/{id} 完成后取消。 DELETE /recurrences/{id}.
initial_payment_paid 表示首次扣款已在结账时得到确认。如果首次扣款安排在以后,签约时不会收款。
过期链接不会启动未经请求的续订。 对于更改后的条款,请取消原始条款并获得新的同意。
Teya 循环需要 transactions/online/create 和 transactions /online/id/get。 确定的临时 Teya decline 会在 24 小时和 72 小时(最多 3 次尝试)重新尝试之前重新检查。
保存在供应商,没有购买(付款:设置)
{
"mode": "setup",
"storage": "provider",
"person_id": "{{person_id}}",
"currency": "GBP",
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/cards"
}保存到租户库中,无需提供程序 (vault:write)
{
"mode": "setup",
"storage": "tenant_vault",
"person_id": "{{person_id}}",
"embed_origin": "https://shop.example",
"return_url": "https://shop.example/cards"
}Stripe 和 Teya 接受提供商选择 ( " stripe"或"teya " ) ;否则使用租户默认值。
Stone 集成等待巴西产品的选择。 没有自动供应商替换。
return_url 必须使用 HTTPS。 将 embed_origin 设置为商店的确切 HTTPS 源以请求嵌入式结账。
将 checkout_url(包括其片段)视为私人买家链接,其初始访问窗口为一小时。
购物者可以直接打开 URL。 当演示文稿嵌入时,商店也可以装载它:
<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>为 Stripe 配置存储的可发布密钥。为 Teya 使用 store-specific OAuth 凭据及其支付 webhook 公钥。仅返回托管的提供程序 URL 使用重定向。允许 Chronosfy 在您的网站的起源 frame-src 以及 script-src加上 SDK配置提供程序的框架和连接。
GET /settings/payment/webhook-url (所有者)暴露 webhook_urls.stripe 以及 webhook_urls.teya,甚至在切换默认值之前。
租户保管库使用隔离的 Chronosfy 框架。 将卡片数据与商家脚本、MCP、日志和 webhook 有效载荷分开。
订阅我们 checkout.session.completed, checkout.session.failed, checkout.session.expired 以及 checkout.session.needs_review.
GET /checkout/sessions/{id} 需要付款:阅读。 仅满足已完成的付款。
卡片已为指定的人保存。 payment_method_id 确定一个 Stripe 支付方式,保险箱卡或 Teya 注册内部 Chronosfy;现有 off-session 扣款工具支持 Stripe 或配置的库路径。
Teya服务提供商的参考信息会被加密保存。返回、重定向或SDK回调仅表示浏览器的跳转。
调解器和提供程序通知独立于浏览器结束。为 Teya 设置,交付 payment.succeeded.v1 至 https://chronosfy.com/api/checkout/webhooks/teya/{tenant} 用于关联验证令牌。
MCP:使用相同的主体加上request_key调用create_checkout_session。使用{ "id": "..." }调用get_checkout_session。
冲突(409)时,检查原始主体,超时后重复原始请求和密钥。
使用 GET 为终端结果;然后有一个重播 checkout_url对于现有的付款链接,请继续使用 /payment/links.
## 退款
Stripe 和 Teya 支持全额和部分退款。金额使用该货币的最小单位。每笔新退款使用一个新密钥,重试同一笔退款时沿用原密钥。只有 succeeded 表示退款已确认。退款后,未来的续费仍按计划进行。
支付服务商已退款
`already_refunded_externally`
已通过其他申请退款
`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## 银行卡处理响应
gateway_response 提供 Chronosfy 的操作、状态和代码。provider_response 保留允许向商户展示的服务商原始字段,包括可用的发卡机构代码。本地存储、未收到响应或旧记录未保存响应时,其值为 null。浏览器返回后,请在服务器上使用结账 ID 查询结果。
{
"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"
}
}## 默认支付服务商
保存凭据会保留当前的默认设置,添加首个服务商时也是如此。租户所有者需要选择一个已保存的账户并确认,才能将其用于新的默认支付。在设置默认服务商前,也可以在结账时明确指定服务商。
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})