Works online and on all your devices

Flashpay

Add bank transfer 2.0 to your checkout in three steps.

Before you start

Sandbox and production

Build and test against sandbox, then switch every URL, your API key and your store ID to production when you go live. The two environments don't share data: a sandbox key or store ID is rejected by production, and the other way round.

SandboxProduction
APIhttps://api.sandbox.flashpayweb.comhttps://api.flashpayweb.com
Checkouthttps://pay.sandbox.flashpayweb.comhttps://pay.flashpayweb.com
Merchant portalhttps://app.sandbox.flashpayweb.comhttps://app.flashpayweb.com

The examples below use production URLs. The checkout also defaults to production, so a sandbox integration must set the checkout origin too (see Embed the checkout). Otherwise sandbox payments open in the production checkout and aren't found.

Authentication

All API requests require a secret key sent as a Bearer token. Create one in the merchant portal under Settings → API details, in the environment you're calling: sandbox keys only work with the sandbox API.

The full API reference is on the Flashpay Developer Portal.

Header
Authorization: Bearer YOUR_SECRET_KEY

Keep your secret key server-side. Never expose it in frontend code or public repositories.

01

Create a payment

Before embedding the checkout, create a payment from your server for the store the sale happens at. The response's id is the transactionId you pass to the checkout.

amount INTEGER
In the smallest currency unit (kobo for NGN). NGN 5,000 = 500000.
storeId STRING
The location ID of the store taking the payment, starting with loc_. In the merchant portal, open Merchants, pick the store and choose Copy store ID. It must belong to the same organization as your API key, or the request fails with Store not found. Sandbox and production have different store IDs. If you leave it out, the payment goes to your workspace's default online store and the response carries a Warning header: storeId will become required.
destinationType STRING, OPTIONAL
BANK_ACCOUNT (the default) or VIRTUAL_ACCOUNT. Use VIRTUAL_ACCOUNT when the destination is a checkout virtual account.

Your merchant comes from your API key, so don't send a business or merchant ID. Fields the API doesn't know are rejected with a 400.

POST /api/v1/payment
curl -X POST https://api.flashpayweb.com/api/v1/payment \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "storeId": "loc_YOUR_STORE_ID",
    "amount": 500000,
    "currency": "NGN",
    "reference": "order-1042",
    "idempotencyKey": "order-1042",
    "description": "Order #1042",
    "destinationType": "VIRTUAL_ACCOUNT",
    "destinationBankId": "YOUR_BANK_CODE",
    "destinationAccount": "YOUR_ACCOUNT_NUMBER",
    "destinationAccountName": "Your Business Ltd"
  }'
02

Embed the checkout

Pass the transactionId to the Flashpay checkout. Pick the integration that matches your stack: a script tag, the browser SDK, React or Vue.

Use the checkout of the environment you created the payment in. The checkout defaults to production. For sandbox, load the script from https://pay.sandbox.flashpayweb.com (it uses the origin it was loaded from), or pass origin: "https://pay.sandbox.flashpayweb.com" to the browser SDK, React or Vue.

<!-- Sandbox: https://pay.sandbox.flashpayweb.com/sdk/flashpay.js -->
<script src="https://pay.flashpayweb.com/sdk/flashpay.js"></script>

<div id="flashpay-checkout"></div>

<script>
  Flashpay.checkout({
    transactionId: "txn_xxx",
    container: "#flashpay-checkout",
    onSuccess: (data) => console.log("Payment successful", data),
    onFailure: (data) => console.log("Payment failed", data),
    onClose:   (data) => console.log("Checkout closed", data),
  });
</script>
03

Handle the result

All three callbacks receive a PaymentEventData object.

  • onSuccessPayment status is SUCCESSFUL or COMPLETED
  • onFailurePayment status is FAILED
  • onCloseCustomer closes the checkout widget or cancels the payment, or status is CANCELLED or EXPIRED
PaymentEventData
FieldTypeDescription
statusstringSUCCESSFUL (the customer paid), FAILED, CANCELLED (cancelled by the customer, by you, or by the bank before payment), EXPIRED, or COMPLETED (you confirmed receipt with the session ID)
transactionIdstringThe transaction ID
payment.amountnumberAmount in kobo
payment.currencystringe.g. NGN
payment.descriptionstringPayment description
payment.destinationAccountNamestringRecipient display name
payment.callbackUrlstring?Redirect URL if provided

After you're paid

Confirm receipt

SUCCESSFUL means the customer paid, so fulfil the order then. COMPLETED records that you received the money. Nothing waits on it.

When the credit lands, send the NIP session ID from your provider's credit notification, with the same secret key you create payments with. If the paying bank reported no session ID, Flashpay records yours.

200
The payment, now COMPLETED. A retry with the same session ID also returns 200.
400
The sessionId is missing or not 30 digits, or the body has a field the API doesn't know.
404
No payment with that ID in your account.
409
The payment isn't SUCCESSFUL yet, the session ID doesn't match the one the bank reported, or the payment is already COMPLETED with a different session ID.

Payments and webhooks carry destinationType and sessionId: the 30-digit NIP session ID the paying bank reported, the one you sent on confirm when the bank didn't report one, or null.

PATCH /api/v1/payment/{id}/complete
curl -X PATCH https://api.flashpayweb.com/api/v1/payment/PAYMENT_ID/complete \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "YOUR_30_DIGIT_SESSION_ID"
  }'

The 200 response is your confirmation. It carries the payment with status: "COMPLETED", and no further webhook is sent. Retrying with the same session ID is safe.

Before it's paid

Cancel a payment

Cancel a payment the customer hasn't paid yet, with the same secret key you create payments with. No body. CANCELLED is final: the payment can't be paid after it.

200
The payment, now CANCELLED. Also returned when it was already cancelled.
404
No payment with that ID in your account.
409
It's no longer open: a bank has picked it up, or it's already paid, failed or expired.
PATCH /api/v1/payment/{id}/cancel
curl -X PATCH https://api.flashpayweb.com/api/v1/payment/PAYMENT_ID/cancel \
  -H "Authorization: Bearer YOUR_SECRET_KEY"