RapidCents V1 API
Checkout overview
Your backend creates a checkout session with RapidCents. The response includes checkout_url (where the shopper pays) and a session token. Never call session APIs from the browser with your API key.
Checkout modes
Payment UI on your domain. Cart and subscription checkout.
Integration guide → Hosted checkoutFull-page handoff to RapidCents; return via success_url / cancel_url.
Quick payment (modal, iframe, or new window); one-time charges, minimal JSON. No subscriptions.
Integration guide →
Subscription checkout — same v1/checkout/create API with mode: subscription (embedded or hosted). See the guide for plan fields and line_items.
APIs you need
- Embedded / Hosted / Subscriptions —
POST {API origin}/api/v1/checkout/create(JSON). - RapidPay —
POST {API origin}/api/v1/checkout-pay(JSON). - Session details —
GET {API origin}/api/v1/checkout/{session_token}/details. Use the sessiontokenfrom your create or pay response. After the shopper pays, this returns updatedcheckout_sessionstate and, when available, atransactionobject with the approved charge. Optional:?expand=refundsto include refund rows for that charge. The payment id for void and refund istransaction.transactionID. - Void —
POST {API origin}/api/v1/voids. Body:{"payment": "<payment id>"}. Use while the approved charge is still in an open batch. - Refund —
POST {API origin}/api/v1/refunds. Body:paymentand optionalamountin cents. Omitamountto refund the full remaining balance. Retrieve one refund withGET {API origin}/api/v1/refunds/{refund_id}.
Staging vs production base URLs:
Staging
API origin (no path)
https://uatstage00-api.rapidcents.com
Typical base URL to configure
https://uatstage00-api.rapidcents.com/api
Production
API origin (no path)
https://api.rapidcents.com
Typical base URL to configure
https://api.rapidcents.com/api
Authentication
The V1 API uses API key authentication. Your secret API key (rc_sk_...) is created in the RapidCents dashboard and used as a Bearer token on all server-side requests.
- Create an API key in the RapidCents dashboard; set the
intended_domainto your app's HTTPS origin. - Keep your
rc_sk_key on the server only. Never expose it in client-side code. - Use
Authorization: Bearer rc_sk_...on all API requests.
Create an API key
In the RapidCents dashboard open Developers → API keys (/dashboard/developers/api-keys) and add a key.
- Intended domain — your app's public HTTPS origin, for example
https://shop.example.com. Every checkout request must send that same value in theOriginheader. - Secret — the dashboard shows
rc_sk_...once. Copy it then. It is not shown again. - This demo — Admin → Gateways → edit the environment → paste it into Secret API key.
API key security
Your secret API key grants full access to checkout APIs. Store it encrypted, never commit it to version control, and never include it in browser-side JavaScript.
Create a webhook secret
The webhook signing secret is separate from the API key. RapidCents uses it to sign each delivery. Your server uses the same value to verify the Signature header.
- In the dashboard open Developers → Webhooks (
/dashboard/developers/webhooks) and add an endpoint. - URL — your public HTTPS receiver. For this demo, use the URL shown on the gateway form (
/webhooks/payment). - Events — select the events you want, including checkout, payment, and subscription events.
- Signing secret — the dashboard shows
rc_whsec_...once, when the endpoint is created and again if you rotate it. Copy it then. - This demo — paste that value into the gateway environment Webhook secret field. When it is set, this app rejects deliveries whose HMAC-SHA256 signature does not match the raw body.
Payload shape, signature check, and event list: Webhooks.
Checkout request headers
All V1 checkout API requests require:
-
Authorization: Bearer rc_sk_...- your secret API key from the RapidCents dashboard. -
Origin- HTTPS origin of your app (for examplehttps://shop.example.com). It must match theintended_domainconfigured on your API key. -
Content-Type: application/jsonandAccept: application/json.
Never expose your API key in the browser
Create checkout sessions on your server only. Do not send the API key to client-side JavaScript.
HTTP headers
Required on every V1 checkout API call from your backend.
Authorization
string
Origin
string
Content-Type
string
Accept
string
Example: create session (embedded)
Staging. Full body field tables are in each mode guide.
curl -sS -X POST "https://uatstage00-api.rapidcents.com/api/v1/checkout/create" \
-H "Authorization: Bearer rc_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Origin: https://your-https-app.example.com" \
-d '{
"ui_mode": "embedded",
"mode": "payment",
"amount_total": 49.99,
"amount_subtotal": 49.99,
"currency": "CAD",
"success_url": "https://your-https-app.example.com/thank-you?order=1",
"cancel_url": "https://your-https-app.example.com/cart",
"customer_email": "buyer@example.com",
"line_items": [
{ "name": "Item", "quantity": 1, "unit_amount": 49.99, "total": 49.99 }
]
}'
Example response
HTTP 200, JSON with ok: true and checkout_session:
{
"ok": true,
"message": "Checkout session created successfully",
"status": "PENDING",
"checkout_session": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"token": "a1b2c3d4e5f6789012345678901234567890abcdef0123456789abcdef012345",
"checkout_url": "https://checkout.rapidcents.com/session/a1b2c3d4\u2026/embedded",
"allowed_origins": [
"https://shop.example.com"
],
"expires_at": "2026-04-21T18:00:00.000000Z",
"session_status": "PENDING",
"payment_status": "UNPAID",
"amount_total": 49.99,
"amount_subtotal": 49.99,
"amount_tax": 0,
"amount_discount": 0,
"surcharge": false,
"amount_surcharge": 0,
"surcharge_rate": null,
"currency": "CAD",
"mode": "payment",
"description": null,
"customer_id": null,
"customer_email": "buyer@example.com",
"customer_name": "Alex Rivera",
"client_reference_id": null,
"success_url": "https://shop.example.com/thank-you?order=1",
"cancel_url": "https://shop.example.com/cart",
"return_url": null,
"metadata": [],
"ui_mode": "embedded",
"created_at": "2026-04-21T12:00:00.000000Z",
"billing_address_collection": null,
"shipping_address_collection": null,
"billing_address": null,
"shipping_address": null,
"consent": null,
"consent_collection": null,
"phone_number_collection": null,
"line_items": [
{
"name": "Premium plan (monthly)",
"quantity": 1,
"unit_amount": 49.99,
"total": 49.99
}
],
"discounts": null,
"apply_discount": null,
"total_details": null,
"invoice_creation": null,
"tax_id_collection": null
},
"transaction": null
}
checkout_session.token— store as your external session or order correlation id.checkout_session.checkout_url— load in an iframe, new tab, or follow as a redirect depending on the mode.
Retrieve checkout details after payment
Do not rely on the success page or iframe postMessage alone to prove payment. On your server, call the session details endpoint with your API key, passing the token from checkout_session (returned by v1/checkout/create or v1/checkout-pay). Poll or call once after redirect/notification until payment_status and session_status reflect the outcome; use transaction (when present) for the processor reference and amount. Webhooks, if enabled for your integration, remain the preferred source of truth for fulfillment—use details to reconcile in-app state.
Replace {session_token} with the session token string. Optional query: expand=refunds (include refund list when a successful charge exists).
Staging example:
curl -sS -G "https://uatstage00-api.rapidcents.com/api/v1/checkout/SESSION_TOKEN_FROM_CHECKOUT_SESSION/details" \
--data-urlencode "expand=refunds" \
-H "Authorization: Bearer rc_sk_YOUR_SECRET_KEY" \
-H "Accept: application/json" \
-H "Origin: https://your-https-app.example.com"
Omit --data-urlencode "expand=refunds" and the ? query if you do not need refund rows.
{
"ok": true,
"message": "Checkout session created successfully",
"status": "COMPLETED",
"checkout_session": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"token": "a1b2c3d4e5f6789012345678901234567890abcdef0123456789abcdef012345",
"checkout_url": "https://checkout.rapidcents.com/session/a1b2c3d4\u2026/embedded",
"allowed_origins": [
"https://shop.example.com"
],
"expires_at": "2026-04-21T18:00:00.000000Z",
"session_status": "COMPLETED",
"payment_status": "PAID",
"amount_total": 49.99,
"amount_subtotal": 49.99,
"amount_tax": 0,
"amount_discount": 0,
"surcharge": false,
"amount_surcharge": 0,
"surcharge_rate": null,
"currency": "CAD",
"mode": "payment",
"description": null,
"customer_id": 1001,
"customer_email": "buyer@example.com",
"customer_name": "Alex Rivera",
"client_reference_id": null,
"success_url": "https://shop.example.com/thank-you?order=1",
"cancel_url": "https://shop.example.com/cart",
"return_url": null,
"metadata": {
"order_id": "42"
},
"ui_mode": "embedded",
"created_at": "2026-04-21T12:00:00.000000Z",
"line_items": [
{
"name": "Premium plan (monthly)",
"quantity": 1,
"unit_amount": 49.99,
"total": 49.99
}
]
},
"transaction": {
"code": "AA",
"message": "Approved Transaction (Auths / Reversals)",
"receiptID": 50001,
"transactionID": 90001,
"details": {
"merchant_name": "Example Merchant",
"merchant_address": "123 Main St",
"merchant_number": "+1-555-0100",
"card": "VISA 4242",
"date": "Mon, Apr 21, 2026 1:15 PM",
"association": "Visa",
"amount": 49.99,
"customer": {
"id": 1001,
"name": "Alex Rivera",
"email": "buyer@example.com"
},
"issuer_reference": "AUTH123456",
"source": "checkout_session"
}
}
}
checkout_session— current session and payment state;session_status/payment_statusreflect completion.transaction—nullif no card attempt yet; when paid, includes approval fields andtransactionIDfor support and reconciliation.- Optional query
?expand=refunds— when the session has a successful charge, includes arefundsarray on the transaction object (shape varies; omitted in this example).
Void a payment
Void an approved charge while its batch is still open. Call this from your server with the same API key and Origin header as checkout. Pass the RapidCents payment id: transaction.transactionID from session details, or transaction.id from a payment.succeeded webhook. After the batch settles, refund the payment instead. A successful void returns the updated payment with status: "voided". This demo still waits for the payment.voided webhook before it updates the local checkout session.
JSON body. payment is the RapidCents payment id (the history id), the same value as transaction.transactionID.
payment
string
Staging example (payment id 90001 matches the session-details sample):
curl -sS -X POST "https://uatstage00-api.rapidcents.com/api/v1/voids" \
-H "Authorization: Bearer rc_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Origin: https://your-https-app.example.com" \
-d '{
"payment": "90001"
}'
{
"id": 90001,
"object": "payment",
"amount": 4999,
"amount_received": 4999,
"amount_refunded": 0,
"currency": "cad",
"status": "voided",
"paid": false,
"is_voided": true,
"void_reference": "VOID123456",
"created": 1713700000
}
id— same payment id you sent aspayment.amount— original charge in minor units (cents).status—voidedwhen the void succeeds.is_voidedistrue.- The live object also includes card, customer, and processor fields. Webhook
payment.voidedis the signal this demo uses to update local session status.
Refund a payment
Refund a settled charge in full or in part. amount is an integer in minor units (cents). Omit amount to refund whatever balance remains. A partial refund returns HTTP 201 and later sends payment.partially_refunded. A refund of the full remaining balance sends payment.refunded. Read the refund again with GET /api/v1/refunds/{refund_id} using the id from the create response.
JSON body. amount is optional and is specified in cents. The same payment id as void.
payment
string
amount
integer
Staging example (partial refund of 5.00 against payment 90001):
curl -sS -X POST "https://uatstage00-api.rapidcents.com/api/v1/refunds" \
-H "Authorization: Bearer rc_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Origin: https://your-https-app.example.com" \
-d '{
"payment": "90001",
"amount": 500
}'
{
"id": 91002,
"object": "refund",
"payment": 90001,
"amount": 500,
"currency": "cad",
"status": "succeeded",
"created": 1713700100
}
id— refund id. Use it withGET /api/v1/refunds/{refund_id}.payment— original payment id.amount— refunded amount in cents.status—succeededwhen the processor approves the refund.
Replace {refund_id} with the refund id from the create response. Returns the same refund object.
Staging example:
curl -sS "https://uatstage00-api.rapidcents.com/api/v1/refunds/91002" \
-H "Authorization: Bearer rc_sk_YOUR_SECRET_KEY" \
-H "Accept: application/json" \
-H "Origin: https://your-https-app.example.com"
Browser / frontend
- Keep your API key (
rc_sk_) on your server only; your frontend should talk to your backend and let the backend call RapidCents. - Embedded (
v1/checkout/create) — Requiredcheckout.jsat{API origin}/js/checkout.js(RapidCentsCheckout). Staging / production:https://uatstage00-api.rapidcents.com/js/checkout.js·https://api.rapidcents.com/js/checkout.js. Guide + sample: Embedded → checkout.js, embedded sample HTML. - Hosted — Redirect to
checkout_urlafter create succeeds. - RapidPay — After server
v1/checkout-pay, use requiredrapid.jswithdata-checkout-urlto inject thecheckout_urlin aniframe({API origin}/js/rapid.js). - If you use
postMessage, verifyevent.originmatches the checkout URL origin (and for embedded, thatevent.sourceis the checkout iframe).
Success & cancel URLs
Creating a session returns payment UI (checkout_url) and a token. Redirects and postMessage improve UX only—confirm capture on your server using the mechanism RapidCents documents for your integration before fulfilling orders.
By checkout mode
- Embedded — Use required
checkout.js(RapidCentsCheckout.createwithui_mode: embedded) so the library mounts the iframe and handlespostMessage(rc:checkout_height,rc:checkout_result), or create the session on your server and set the iframesrctocheckout_urlyourself. Always validatee.sourceande.originif you listen for messages. See Embedded → checkout.js. - Hosted — After
200, send the browser tocheckout_urlwith302or303(prefer303after a POST “start checkout” so the form is not resubmitted). The shopper returns to yoursuccess_urlorcancel_urlwhen checkout finishes. - RapidPay —
v1/checkout-paydoes not acceptsuccess_url/cancel_urlin the body. Mountcheckout_urlin the browser withrapid.js(data-checkout-url), then handlepostMessage(or therapidcents-checkoutevent) as needed; confirm payment server-side before fulfillment. - Subscriptions — Same
success_url/cancel_urlbehaviour as one-timecheckout/createwhen the API requires those fields.
success_url
- Absolute
https://URL; add your own id in the query if needed. - Not proof of payment—users can open or replay the URL. Keep “thank you” logic idempotent.
cancel_url
- Absolute
https://URL where RapidCents may send the shopper if they abandon checkout (when the API requires it).
Security
- Never send your secret API key (
rc_sk_...) to the browser or mobile app—keep it server-side only. - Store your API key encrypted at rest; never commit it to version control.
Originmust be HTTPS and match theintended_domainconfigured on your API key.- Call RapidCents only over TLS; do not disable certificate checks in production.
- Log session
tokenand your own order ids for support.
Common errors
Common HTTP status codes
- 401 Unauthorized — Missing or invalid API key. Check that you're using a valid
rc_sk_...key in theAuthorization: Bearerheader. - 403 Forbidden — API key is valid but not allowed for this business or operation.
- 422 Unprocessable Entity — Validation failed (missing fields, wrong types, amounts out of range, invalid currency, or
Origindoesn't matchintended_domain). Read the response body for field errors. - 400 Bad Request — Malformed JSON or an invalid combination of fields (for example,
ui_mode/mode).
Common integration mistakes
- Origin mismatch —
Originheader does not match theintended_domainconfigured on your API key. - Wrong environment — Staging credentials or base URL used against production, or the reverse.
- Invalid return URLs —
success_url/cancel_urlnot absolute HTTPS where the API requires them. - Amounts — Use decimal amounts to the precision the API expects; avoid floating-point drift in application code.