Documentation Index
Fetch the complete documentation index at: https://docs.gosurge.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Merchant Registration
Before integrating, you need a Surge merchant account. You can register via the dashboard or the API.Via Dashboard (Recommended)
Sign up at merchant.gosurge.xyz/register. Once approved, retrieve your Secret Key from Settings → API Keys.Via API
New merchant accounts require approval before they can create live checkout sessions. You will be notified by email once your account is activated.
Creating a Checkout Session
Before rendering the checkout widget, your backend must initialize a transaction by creating a Checkout Session. This session is short-lived (30 minutes) and secures the transaction details server-side.Endpoint
POST /api/v1/checkout/sessions
Request Headers
| Header | Required | Description |
|---|---|---|
Authorization | ✅ | Bearer <YOUR_SECRET_KEY> |
Idempotency-Key | Recommended | A UUID v4 to prevent duplicate sessions on network retries. |
Payload Parameters
| Field | Type | Description |
|---|---|---|
merchant_id | string | Your merchant ID from the dashboard. |
amount | integer | Total amount in kobo (e.g., 120000 for ₦1,200.00). |
currency | string | ISO 4217 currency code (e.g., NGN). |
title | string | Product or order name shown in the widget. |
order_reference | string | Your internal unique reference for this order. |
customer_email | string | (Optional) Pre-fills the login form for the customer. |
Request Example
Response — Success
Error Responses
| Status | Reason |
|---|---|
404 Not Found | The merchant_id does not exist in our system. |
403 Forbidden | The merchant account is not currently active. |
400 Bad Request | The Idempotency-Key header is not a valid UUID. |
Previewing a Payment Plan
Before completing checkout, you can preview what the installment schedule will look like for a given amount and plan configuration. This is useful for showing customers a breakdown before they confirm.Endpoint
POST /api/v1/checkout/preview
Request
Response
Idempotency
ThePOST /checkout/sessions endpoint supports the Idempotency-Key header to protect against duplicate requests caused by network timeouts, client retries, or double-clicks.
How it works
- Generate a UUID v4 and attach it as the
Idempotency-Keyheader on your request. - If your request times out or fails at the network layer, re-send the exact same request with the same
Idempotency-Key. - Surge will return the original session — no duplicate session or double-charge will occur.
- Keys expire after 24 hours. After expiry, the same key will create a fresh session.
Payment Links
Payment links are reusable, shareable URLs that let customers check out without needing a server-side session. Ideal for sharing via WhatsApp, Instagram, or email.Create a Payment Link
redirect_url is set, the customer is redirected there after a successful checkout instead of their Surge dashboard.