Host-to-Host

Host-to-Host overview

Server-to-server integration: your backend calls ours directly. No hosted page, no redirect, no JS on your checkout.

In a host-to-host integration your server talks to ours. You authenticate with a secret key, you create the charge, and we hand you back the data your buyer needs to pay — a CLABE, a barcode, a QR string, or a redirect URL for rails that require one. You render it in your own UI. We never inject a script into your checkout and your buyer never leaves your domain unless the rail itself demands it.

What host-to-host means here

Concretely: every call in this section is made from your backend, with a secret key that never reaches a browser. That single constraint is what makes the model work — it is why the API can trust the caller with money movement, buyer data and payouts.

Secret keys only. Every endpoint in this section requires an sk_live_ / sk_test_ key (or a bearer token minted from one). Publishable keys (pk_*) are safe to expose in a browser or mobile app precisely because they cannot create charges, issue refunds, read customer data or send payouts. A publishable key on any of these calls returns 403 key_kind_not_allowed.

Host-to-host vs hosted checkout

Both models are supported and both settle identically. The difference is who renders the payment step and who holds the buyer's attention.

 Host-to-hostHosted checkout
Who renders the payment stepYouWe do
Buyer leaves your domainOnly if the rail requires itYes
Credential usedsk_* (server-side)Created server-side, buyer gets a URL
You handle missing buyer dataYes — see the 422 contractWe prompt the buyer
Control over UXTotalOur template + your branding
Integration effortHigherLower

The contract at a glance

Base URLhttps://sandbox.key2pay.ai/api/v1
AuthBearer sk_live_… / sk_test_… (or a token from /auth/token)
Operation currencyAlways USD — we convert to the buyer's local currency
IdempotencyIdempotency-Key on every money call. Scoped per merchant.
EnvironmentThe key decides. A sk_test_ can never touch production data.
WebhooksHMAC-SHA256, signed over <timestamp>.<body>

The endpoints you'll use

The whole host-to-host surface is nine calls. Everything else in this documentation is either an alternative model (hosted checkout) or an operational convenience.

CallWhat it's for
POST /auth/tokenExchange your keys for a 1h bearer token (optional)
GET /payment-methodsWhat you can charge, for this shop, right now
POST /paymentsCreate the charge
GET /payments/{id}Poll the charge — the reconciliation backstop
GET /paymentsList + paginate
POST /payments/{id}/refundOpen a refund
POST /webhooksRegister your endpoint
GET /me/balanceWhat you're owed
POST /me/payout/sendPay someone out