Skip to main content

Merchant Registration

Before integrating, you need a Surge merchant account. You can register via the dashboard or the API. Sign up at merchant.gosurge.xyz/register. Once approved, log in to find your Merchant ID under Settings → API Keys.
1

Register

Go to merchant.gosurge.xyz/register and fill in your business details.
2

Wait for approval

New accounts are reviewed within 24 hours. You’ll receive an email when approved.
3

Generate your API key

Once approved, the Surge team enables API access for your account. Log in to the merchant dashboard, go to Settings → API Keys, and click Generate API Key. Copy the key immediately — it is only shown once. Your Merchant ID (mer_...) is shown on the same page.
Store your credentials as environment variables (SURGE_API_KEY, SURGE_MERCHANT_ID) and never commit them to version control.

Via API

Request
Response
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

Payload Parameters

Request Example

Response — Success

Error Responses

Store the session_token returned from this request and pass it to the Frontend SDK in the next step.

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

The POST /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

  1. Generate a UUID v4 and attach it as the Idempotency-Key header on your request.
  2. If your request times out or fails at the network layer, re-send the exact same request with the same Idempotency-Key.
  3. Surge will return the original session — no duplicate session or double-charge will occur.
  4. Keys expire after 24 hours. After expiry, the same key will create a fresh session.
Generate a new UUID for each distinct order. Reusing the same key for a different order will return the original session, not a new one.

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.
Request
Response
All fields in the payment link response use camelCase (redirectUrl, isActive, createdAt, merchantId, publicUrl). The response schema uses Pydantic’s alias_generator=to_camel.
If redirectUrl is set, the customer is redirected there after a successful checkout instead of their Surge dashboard.