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, log in to find your Merchant ID under Settings → API Keys.Register
Go to merchant.gosurge.xyz/register and fill in your business details.
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
Authentication
Authenticate with your API key on every request:Request Headers
| Header | Required | Description |
|---|---|---|
Authorization | ✅ | Bearer surge_live_sk_... (your Surge API 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
All fields in the payment link response use camelCase (
redirectUrl, isActive, createdAt, merchantId, publicUrl). The response schema uses Pydantic’s alias_generator=to_camel.redirectUrl is set, the customer is redirected there after a successful checkout instead of their Surge dashboard.