OPay as a Service

Create OPay payment links from your server, send customers to OPay to pay, and confirm each payment with a webhook or the status endpoint.

OPay as a Service (OPaaS) lets you collect payments through OPay without using the Atlas hosted checkout. You create a payment request from your server, Atlas returns an OPay payment link, and you send your customer to it. The customer pays in OPay, and Atlas credits your NGN business wallet.

Use OPaaS when OPay is the only payment option you want to offer, or when you build your own checkout and want to add OPay to it. To let customers choose between card, bank transfer and OPay on one page, use hosted checkout instead.

How it works

  1. Your server creates a payment request with an amount, the customer's phone number, and the URLs OPay should return the customer to.
  2. Atlas returns the request with a reference and a cashierUrl, the OPay payment link.
  3. You send the customer to the cashierUrl, where they pay in OPay.
  4. OPay returns the customer's browser to your redirect_url, or to your cancel_url if they cancel.
  5. Atlas credits your wallet and sends an OPAY_PAYMENT_SUCCESSFUL_EVENT webhook. You confirm the payment before you fulfil the order.

A redirect is not proof of payment

OPay sends the customer back to your redirect_url whether or not the payment went through, and anyone can open that URL directly. Only fulfil an order after you receive the OPAY_PAYMENT_SUCCESSFUL_EVENT webhook or the status endpoint returns a successful transaction.

Before you start

Make sure your business meets these requirements before you create a payment request:

  • Your business is registered in Nigeria and has an NGN business wallet. OPaaS only supports NGN.
  • OPay as a Service is turned on for your business. The business owner turns it on under Atlas Dashboard > Settings > Payment > Payment Services. You can only turn it on after OPay is enabled as a checkout method. Until it's on, every OPaaS endpoint returns 403 with the message OPAAS is not enabled for this business.
  • Duplo has enabled OPaaS payments for your business. Contact Duplo to have them turned on. Until they are, the create endpoint returns 403 with the message This feature is not available.
  • You have a webhook URL set. Atlas sends the payment webhook to the webhook URL on your API credentials. See Enabling webhooks on Atlas.

Approved return URL domains

Your redirect_url and cancel_url must use HTTPS, and their domain must exactly match the domain of the webhook URL or callback URL set on your API credentials. Subdomains count as different domains.

For example, if your webhook URL is https://api.acme.com/webhooks/atlas, then https://api.acme.com/payments/return is accepted, but https://shop.acme.com/payments/return is rejected with a 422.

Creating a payment request

To create a payment request, send a request to the Create OPay payment link endpoint. These fields are required:

  • source_reference: your own unique reference for this payment, between 3 and 250 characters, for example your order ID. Atlas uses it to make the request safe to retry.
  • amount: the amount to collect in naira, from 100 to 10,000,000. If the customer bears the fee, Atlas adds the fee on top of this amount.
  • phone_number: the customer's Nigerian phone number.
  • redirect_url: the HTTPS URL OPay returns the customer to after payment. Must be on an approved domain.
  • cancel_url: the HTTPS URL OPay returns the customer to if they cancel. Must be on an approved domain.

The examples below create a ₦25,000 payment request:

curl -X POST "https://atlas.tryduplo.com/api/v1/opaas" \
  -H "Authorization: Bearer your_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "source_reference": "order-10045",
    "amount": 25000,
    "phone_number": "08012345678",
    "redirect_url": "https://api.acme.com/payments/return",
    "cancel_url": "https://api.acme.com/payments/cancel"
  }'

You can also send these optional fields:

  • currency: only NGN is supported. Defaults to NGN.
  • fee_bearer: who pays the transaction fee. MERCHANT (default) deducts the fee from what you receive. CUSTOMER adds the fee to what the customer pays.
  • customer_email: the customer's email address. When you send it, Atlas finds or creates a customer with that email and attaches them to the request.
  • customer_first_name: the customer's first name, up to 250 characters. Required when you send customer_email.
  • customer_last_name: the customer's last name, up to 250 characters. Required when you send customer_email.
  • description: a description of the payment, up to 500 characters.
  • metadata: an object of your own data, up to 30 keys and 4 KB. Atlas returns it on the payment request.

A successful request returns 200 with the payment request. Save the reference: it's the value Atlas uses to identify the payment in webhooks and lookups.

Response
{
  "requestId": "abcd1234-5678-90ef-ghij-1234567890kl",
  "requestTimestamp": "2026-10-23 13:30:00",
  "message": "Opay payment initiated.",
  "statusCode": 200,
  "data": {
    "id": "01a164c3-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
    "businessState": "test",
    "reference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
    "currency": "NGN",
    "sourceReference": "order-10045",
    "status": "initiated",
    "cashierUrl": "https://cashier.opay.example/pay/OPA_ONUWEXKHMJKM55DJERYO1AKI",
    "merchantRedirectUrl": "https://api.acme.com/payments/return",
    "merchantCancelUrl": "https://api.acme.com/payments/cancel",
    "feeBearer": "MERCHANT",
    "opayOrderNo": "251023140012345678",
    "amount": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
    "fee": { "value": 362.81, "currency": "NGN", "formatted": "NGN362.81" },
    "total": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
    "createdAt": "2026-10-23T12:30:00+00:00",
    "metadata": null,
    "customer": null,
    "transaction": null
  }
}

total is what the customer pays. With fee_bearer set to MERCHANT, total equals amount and the fee is deducted from your wallet after the payment is credited. With CUSTOMER, total is amount plus fee.

Payment statuses

The status field shows where the payment request is:

StatusMeaning
provisioningAtlas saved the request but hasn't received the OPay order and link yet. Retry safely to get the link.
initiatedThe payment link is ready and Atlas is waiting for the customer to pay.
completedThe customer paid and Atlas credited your wallet.
under_reviewThe payment Atlas received doesn't match the request, for example the amount differs. Duplo reviews it, and Atlas doesn't send the OPAY_PAYMENT_SUCCESSFUL_EVENT webhook. Don't fulfil the order.

Sending the customer to OPay

Redirect the customer to data.cashierUrl, or send it to them as a link.

On the OPay page, the customer pays with one of OPay's own payment methods, such as OPay Wallet or bank card. When they finish, OPay sends their browser to your redirect_url. If they cancel, OPay sends them to your cancel_url.

Atlas adds the payment's Atlas reference to both URLs as a ref query parameter. For example, a customer returning from the request above lands on:

Return URL
https://api.acme.com/payments/return?ref=OPA_ONUWEXKHMJKM55DJERYO1AKI

Don't include a query string in your redirect_url or cancel_url, because Atlas adds the ref parameter for you.

Treat both URLs as a way to bring the customer back to your site, not as a payment result. On your return page, read ref, show the customer that you're confirming their payment, then wait for the webhook or check the payment status.

Retrying safely

source_reference makes the create endpoint idempotent. If a request times out or you aren't sure it reached Atlas, send it again with the same source_reference and the same body:

  • Same source_reference, same body: Atlas returns the payment request it already saved, without creating a second OPay order.
  • Same source_reference, different body: Atlas rejects the request with 409.

If the create endpoint returns 500, the OPay order may already exist even though Atlas couldn't save the payment link. Don't create a new request with a different source_reference. Look the request up with the Get OPay request by merchant reference endpoint, or retry with the same source_reference and body.

If a request has the status provisioning, Atlas hasn't received its payment link yet. To get the link, send the same create request again with the same source_reference and body. This doesn't create a second OPay order.

Confirming a payment

Confirm every payment from your server before you fulfil the order. You can use the webhook, the status endpoint, or both.

Handling the payment webhook

When Atlas credits a payment to your wallet, it sends an OPAY_PAYMENT_SUCCESSFUL_EVENT webhook to your webhook URL. Atlas signs it the same way as its other webhooks, so verify the webhook signature before you trust the payload.

The data object is the credit transaction for the payment:

OPAY_PAYMENT_SUCCESSFUL_EVENT
{
  "event_type": "OPAY_PAYMENT_SUCCESSFUL_EVENT",
  "data": {
    "id": "01a164c3-9b15-7091-bc9b-32289fca8b31",
    "type": "credit",
    "sourceReference": null,
    "parentTransactionReference": null,
    "reference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
    "status": "successful",
    "amount": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
    "balanceBefore": {
      "value": 163243.18,
      "currency": "NGN",
      "formatted": "NGN163243.18"
    },
    "balanceAfter": {
      "value": 188243.18,
      "currency": "NGN",
      "formatted": "NGN188243.18"
    },
    "createdAt": "23/10/2026 12:54pm",
    "fee": [
      {
        "id": "01a164c3-9cbf-736a-89ac-e60dc2397044",
        "type": "debit",
        "sourceReference": null,
        "parentTransactionReference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
        "reference": "TRN_8eDwe2sCzMpn",
        "status": "successful",
        "amount": {
          "value": 337.5,
          "currency": "NGN",
          "formatted": "NGN337.5"
        },
        "balanceBefore": {
          "value": 188243.18,
          "currency": "NGN",
          "formatted": "NGN188243.18"
        },
        "balanceAfter": {
          "value": 187905.68,
          "currency": "NGN",
          "formatted": "NGN187905.68"
        },
        "createdAt": "23/10/2026 12:54pm"
      },
      {
        "id": "01a164c3-9e66-700f-bb3b-c29862e091c4",
        "type": "debit",
        "sourceReference": null,
        "parentTransactionReference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
        "reference": "TRN_l45sWw22ewweKpqF",
        "status": "successful",
        "amount": {
          "value": 25.31,
          "currency": "NGN",
          "formatted": "NGN25.31"
        },
        "balanceBefore": {
          "value": 187905.68,
          "currency": "NGN",
          "formatted": "NGN187905.68"
        },
        "balanceAfter": {
          "value": 187880.37,
          "currency": "NGN",
          "formatted": "NGN187880.37"
        },
        "createdAt": "23/10/2026 12:54pm"
      }
    ],
    "customer": {
      "id": "01a164c2-a486-716d-8d9f-e4cc19d59c98",
      "firstName": "Ada",
      "lastName": "Obi",
      "businessName": "",
      "type": "individual",
      "email": "ada.obi@example.com",
      "phoneNumber": null,
      "reference": "dp_cust_kt66uxkdnb3s6im",
      "businessState": "test",
      "isBlacklisted": false,
      "hasWallet": false,
      "hasNrsCustomer": false,
      "wallet": [],
      "status": "ACTIVE",
      "source": "API",
      "createdAt": "2026-10-23 12:30:00"
    }
  }
}

When you handle the webhook:

  • Match on data.reference. It's the reference returned when you created the request (OPA_...). data.sourceReference is null, so store the mapping between your source_reference and the Atlas reference when you create the request.
  • Check the amount. data.amount is the amount credited to your wallet. Compare it with the total on the payment request.
  • Read the fees from data.fee. Each fee is a separate debit from your wallet, linked to the payment through parentTransactionReference. In the example, the fee is ₦337.50 plus ₦25.31 VAT.
  • Ignore duplicates. Atlas retries a webhook when your endpoint doesn't return a 2xx response, so the same event can arrive more than once. Every delivery of the same event carries the same X-Webhook-Event-Id header. See Handling duplicate events.

Atlas only sends a webhook for successful payments. If the customer returns to your site and you haven't received the webhook, check the payment status.

Checking the payment status

To check whether a payment has been credited, send a request to the Get the OPay request and its transaction endpoint. Pass exactly one of these query parameters:

  • reference: the Atlas reference (OPA_...).
  • source_reference: your own reference.
curl -X GET "https://atlas.tryduplo.com/api/v1/opaas/status?reference=OPA_ONUWEXKHMJKM55DJERYO1AKI" \
  -H "Authorization: Bearer your_API_KEY" \
  -H "Accept: application/json"

The response contains the payment request and a transaction field. transaction is null until Atlas has credited the payment. After that, it holds the successful credit transaction, in the same shape as the webhook's data:

Response
{
  "requestId": "abcd1234-5678-90ef-ghij-1234567890kl",
  "requestTimestamp": "2026-10-23 13:55:00",
  "message": "OPay payment status retrieved.",
  "statusCode": 200,
  "data": {
    "id": "01a164c3-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
    "businessState": "test",
    "reference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
    "currency": "NGN",
    "sourceReference": "order-10045",
    "status": "completed",
    "cashierUrl": "https://cashier.opay.example/pay/OPA_ONUWEXKHMJKM55DJERYO1AKI",
    "merchantRedirectUrl": "https://api.acme.com/payments/return",
    "merchantCancelUrl": "https://api.acme.com/payments/cancel",
    "feeBearer": "MERCHANT",
    "opayOrderNo": "251023140012345678",
    "amount": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
    "fee": { "value": 362.81, "currency": "NGN", "formatted": "NGN362.81" },
    "total": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
    "createdAt": "2026-10-23T12:30:00+00:00",
    "metadata": null,
    "customer": null,
    "transaction": {
      "id": "01a164c3-9b15-7091-bc9b-32289fca8b31",
      "type": "credit",
      "sourceReference": null,
      "parentTransactionReference": null,
      "reference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
      "status": "successful",
      "amount": { "value": 25000, "currency": "NGN", "formatted": "NGN25000" },
      "balanceBefore": {
        "value": 163243.18,
        "currency": "NGN",
        "formatted": "NGN163243.18"
      },
      "balanceAfter": {
        "value": 188243.18,
        "currency": "NGN",
        "formatted": "NGN188243.18"
      },
      "createdAt": "23/10/2026 12:54pm",
      "fee": [
        {
          "id": "01a164c3-9cbf-736a-89ac-e60dc2397044",
          "type": "debit",
          "sourceReference": null,
          "parentTransactionReference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
          "reference": "TRN_8eDwe2sCzMpn",
          "status": "successful",
          "amount": {
            "value": 337.5,
            "currency": "NGN",
            "formatted": "NGN337.5"
          },
          "balanceBefore": {
            "value": 188243.18,
            "currency": "NGN",
            "formatted": "NGN188243.18"
          },
          "balanceAfter": {
            "value": 187905.68,
            "currency": "NGN",
            "formatted": "NGN187905.68"
          },
          "createdAt": "23/10/2026 12:54pm"
        },
        {
          "id": "01a164c3-9e66-700f-bb3b-c29862e091c4",
          "type": "debit",
          "sourceReference": null,
          "parentTransactionReference": "OPA_ONUWEXKHMJKM55DJERYO1AKI",
          "reference": "TRN_l45sWw22ewweKpqF",
          "status": "successful",
          "amount": {
            "value": 25.31,
            "currency": "NGN",
            "formatted": "NGN25.31"
          },
          "balanceBefore": {
            "value": 187905.68,
            "currency": "NGN",
            "formatted": "NGN187905.68"
          },
          "balanceAfter": {
            "value": 187880.37,
            "currency": "NGN",
            "formatted": "NGN187880.37"
          },
          "createdAt": "23/10/2026 12:54pm"
        }
      ]
    }
  }
}

Only fulfil the order when status is completed. A request with the status under_review can also have a transaction, because Atlas received money for it, but the payment doesn't match the request.

The endpoint only returns 404 when no payment request matches the reference. An unpaid request returns 200 with transaction set to null.

Looking up payment requests

You can fetch a payment request at any time to see its current status:

Each lookup only checks its own field: the first doesn't match a source_reference, and the second doesn't match an Atlas reference.

The examples below look up a request by its Atlas reference. To look it up by your own reference, use the path /opaas/source-reference/order-10045 instead:

curl -X GET "https://atlas.tryduplo.com/api/v1/opaas/OPA_ONUWEXKHMJKM55DJERYO1AKI" \
  -H "Authorization: Bearer your_API_KEY" \
  -H "Accept: application/json"

To list payment requests, use the List OPay payment requests endpoint. It accepts these query parameters:

ParameterDescription
statusFilter by status.
referenceFilter by Atlas reference.
source_referenceFilter by your reference.
searchCase-insensitive search across Atlas and your references.
startDateOnly requests created on or after this date (YYYY-MM-DD).
endDateOnly requests created on or before this date (YYYY-MM-DD).
sortdesc (default) for newest first, or asc for oldest first.
pagePage number, starting at 1.
limitResults per page. Defaults to 1000.

The examples below list payment requests that are waiting for the customer to pay, 20 per page:

curl -X GET "https://atlas.tryduplo.com/api/v1/opaas?status=initiated&limit=20&page=1" \
  -H "Authorization: Bearer your_API_KEY" \
  -H "Accept: application/json"

All lookups only return requests that belong to your business and match the mode (test or live) of the API key you use.

Listing OPay transactions

To list the credit transactions for your OPaaS payments, rather than the payment requests, use the List OPay as a Service transactions endpoint. Each item has the same shape as the webhook's data. It accepts page and limit (20 by default, up to 100).

curl -X GET "https://atlas.tryduplo.com/api/v1/opaas/transactions?page=1&limit=20" \
  -H "Authorization: Bearer your_API_KEY" \
  -H "Accept: application/json"

How is this guide?

Last updated on

On this page

Need help? Visit our help center