Skip to main content

Step 1 — Get your API key

  1. Sign up at merchant.gosurge.xyz/register.
  2. After your account is approved, the Surge team enables API access for your account.
  3. Log in to your merchant dashboard, go to Settings → API Keys, and click Generate API Key.
  4. Copy the key immediately — it is shown once. Note your Merchant ID (mer_...) on the same page.
Never hard-code your API key in source files. Use environment variables and never commit them to git.

Step 2 — Create a checkout session (backend)

Your server calls Surge to create a short-lived checkout session tied to the order. Pass the session token to your frontend to open the widget.
Environment variables you need:
.env
All amounts are in kobo (Nigerian lowest denomination). ₦1,200.00 = 120000 kobo. Never pass naira values directly — divide by 100 to display to the customer.

Step 3 — Open the widget (frontend)

Once your server returns the sessionToken, open the Surge checkout modal.
onSuccess fires when the customer confirms the plan, not when their deposit is charged. Always use the payment.success webhook (Step 4) as your trigger to fulfill the order.

Step 4 — Listen for webhooks

Surge sends a payment.success event to your configured webhook URL after the deposit is collected and the plan is activated.

Configure your webhook URL

In your merchant dashboard go to Settings → Webhooks and enter your endpoint URL. Set a strong random string as your Webhook Secret and save it to your SURGE_WEBHOOK_SECRET env var.

Handle the event

Node.js
Surge signs outbound webhooks with HMAC-SHA256 using your webhook_secret. The header is X-Surge-Signature. Return 200 OK immediately and process fulfillment asynchronously to avoid retry storms.
See the Webhooks guide for all event types and retry behaviour.

You’re done

Next steps: