Checkout and renewals — how to use HTTP and MCP
If you want one checkout URL wey go also schedule renewals, use mode=recurring in /docs/quickstart/checkout.
Existing clients fit still use di separate payment link and scheduler steps below.
Base URL na https://chronosfy.com/api. Set up verified Stripe account and tenant webhook first.
Identity verification only checks Accounts: Read (Connect) and Balance: Read. E no confirm say you get all feature permissions.
For dis flow, restricted keys still need Customers: Write, Checkout Sessions: Write, PaymentIntents: Write, PaymentMethods: Read and Events: Read. For separate setup, you need SetupIntents: Write.
Use test or live credentials and publishable keys from di same mode and account. See https://docs.stripe.com/keys.
Use payments:links and payments:setup for Checkout wey save card, payments:read to check am, and di payment action and financial recurrence scopes plus payments:charge to schedule charges.
Before you start, create one person and one payment action with stable creation keys.
1. Send POST /payment/links with Idempotency-Key: checkout:order-42:v1:
{
"person_id": "PERSON_UUID", "amount": 2990, "currency": "BRL", "description": "First month",
"success_url": "https://your-app.example/paid", "cancel_url": "https://your-app.example/cancel",
"save_payment_method": true, "set_as_default": true,
"client_reference_id": "order-42", "metadata": { "plan": "plus" }
}For MCP, use create_payment_link with di same body plus request_key: "checkout:order-42:v1".
Save di link ID wey you get and direct di customer to di hosted URL. Ask di customer to agree to future charges.
set_as_default changes di main card for all future renewals wey never freeze. Leave am out to keep an existing valid main card. Di first valid card go become di main one automatically. Charges wey don freeze go keep their original card.
2. Check di server state with GET /payment/links/LINK_UUID or get_payment_link({link_id}).
Redirect to success_url alone no prove say dem don pay. status=completed mean say di payment don go through. payment_method_status get separate meaning:
not_requested = nobody ask make dem save di card; pending = dem dey recover di link to di card; saved = di local card ID don dey available.
needs_review = di operator must check payment_method_error. No charge di customer again to fix problem with saving card.
payment.link.completed get both states. If dem link di card later, di system send payment.link.payment_method.saved.
When review dey needed, di system send payment.link.requires_attention. Use event_id to remove duplicates and follow state_version.
Di reconciler dey try to read pending card details again, up to 20 attempts. Di time between attempts get limit. After dat, person must review am.
3. Only after completed + saved, send POST /recurrences with Idempotency-Key: renewal:subscription-42:v1:
{
"name": "Plan renewal", "action_id": "PAYMENT_ACTION_UUID", "subject_id": "PERSON_UUID", "subject_type": "person",
"amount": 2990, "currency": "BRL", "client_reference": "subscription-42",
"frequency_config": { "type": "monthly", "day": 12, "time": "09:00", "timezone": "Europe/London" },
"first_run_at": "FUTURE_ISO_8601_WITH_TIMEZONE"
}For MCP, use create_recurrence with di same body plus request_key: "renewal:subscription-42:v1".
Choose first_run_at once based on when di period wey dem don pay for go end. E must still dey for future and no pass 400 days from now.
Use di same value each time you retry, even after di date don pass. Calendar schedules pick di first matching time on or after dat date. If day 1 na di monthly date and December 12 na di minimum, e go start January 1. E no go start December 12.
Interval schedules start exactly at di time wey you set. If you pause, resume or change frequency, dat time no go change.
Check next_run_at for di response. If you trigger am now by hand, na separate charge wey you explicitly ask for.
For recovery, use di same keys and body for HTTP and MCP. Di same key with changed payload go return 409.
PAYMENT_CUSTOMER_PENDING (409 if busy or 502 if di result no clear) mean say make you wait small, then send di same request again.
If you get PAYMENT_CUSTOMER_REVIEW_REQUIRED, check how di account, mode and customer dey linked. No reset am without checking.
If di Customer outcome still no clear after 23 hours, we no go create am again. Older Customer records wey conflict need review.
If dem clearly refuse a Customer prerequisite (422), fix di problem and retry di same logical request.
If di link get failed + provider_failure, Checkout don finally refuse am. Correct di problem and create new logical link.
If payment card status show error, na di state of dat resource. E no prove say di first payment fail.
MCP HTTP 200 fit still get isError=true. Check structuredContent.status_code/error/fields/details.
Dis flow no support cancelling at period end, proration or hosted portal to change card.
## Card for this recurrence
Select a saved card for future charges on this schedule. Charges already started keep their card. Direct card registration uses Stripe without Link.
GET /api/recurrences/{recurrence_id}/payment-method
PUT /api/recurrences/{recurrence_id}/payment-method
Content-Type: application/json
{"payment_method_id":"<cards[].id>"}`get_recurrence_cards`, `set_recurrence_card`
## Refunds
Stripe and Teya fit return all di money or part of am. Enter di amount for di smallest unit of di currency. Use new key for each separate refund. If you send di same request again, use di same key. Na only succeeded confirm say di refund don go through. Di next renewals still dey on schedule.
Di provider don refund am
`already_refunded_externally`
Anoda request don refund am
`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## Di reply wey card processing give
gateway_response show di Chronosfy operation, status and code. provider_response keep di provider original fields wey merchant fit see, plus di card issuer codes if dem dey. E go be null if na local storage, if reply no come, or if old record no get saved reply. After di browser come back, use di checkout ID check di result for your server.
{
"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"
}
}## Try other cards wey dem save
Every round start with di main card. If di bank confirm say e decline am and another try dey allowed, di system go try di other cards one by one. E go stop once payment pass, result still dey pending, dem ask for identity check, or fraud block show. If di problem na temporary one, di same instalment fit run again after 24 hours, then 72 hours later if e still need am. Teya go use di card wey di customer authorise for dat payment.
E dey on by default. You fit turn am off for di business, one customer or one regular payment. If e dey off for any level, e go stay off.
GET /settings/payment/card-retries
GET /payment/methods/{person_id}/card-retries
GET /recurrences/{recurrence_id}/card-retries
PUT /settings/payment/card-retries
PUT /payment/methods/{person_id}/card-retries
PUT /recurrences/{recurrence_id}/card-retries
{"enabled":false}
GET /recurrences/{recurrence_id}/card-attempts`enabled` · `effective_enabled` · `disabled_by`
MCP · `get_card_retry_settings` · `set_card_retry_settings` · `list_recurrence_card_attempts`
Payment event version
If dem decline one card, na one attempt. Final failure go close dat installment after di retries. Old subscriptions go keep version 2 until you choose version 3.
`payment.attempt.failed` · `payment.succeeded` · `payment.failed`
`PUT /events/webhooks/{id}/payment-event-version` · `{"version":3}` · MCP `set_payment_event_version`
## Default payment provider
If you save login details, di default go stay as e be, even for di first provider. To choose di account for new payments, di tenant owner go pick one saved account and confirm di change. You fit name di provider for checkout before you choose 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})