Skip to content
Sign in Start now

Developers

MSIA Oculus integration guide

Take card payments from your own checkout with one REST API: create a payment, let us run 3-D Secure, then capture, refund or void it. Test keys use the sandbox; swap to live keys to go live.

  • API v1
  • REST
  • JSON
  • HTTPS only

Overview

Your server calls the API; your customer's browser only ever visits your checkout, the 3-D Secure page we host, and your return URL. A card payment takes four steps.

  1. Get credentials. Finish onboarding, then generate test credentials on your application page: an API key, an API secret and your store identifier.
  2. Create the payment. Your server sends the order, customer and card to POST /payments.
  3. Complete 3-D Secure. If the response has serverAuthentication: true, redirect the customer's browser to redirectUrl. Their bank may ask them to confirm; then we send them back to your returnUrl.
  4. Confirm the result. Check the payment from your server with GET /payments/{transactionReference} or wait for the webhook. Never rely on the browser redirect alone.

Card numbers and security codes pass through our servers to the card network and are never stored. Because your server handles card data, your business must meet the PCI DSS requirements that apply to you.

Authentication

Send these headers with every request. Credentials are issued per business from your application page in the dashboard; the secret is shown once, when you generate it.

HeaderRequiredDescription
X-Api-KeyRequiredYour key ID. Test keys start ok_test_, live keys ok_live_.
X-Api-SecretRequiredThe secret issued with the key (sk_test_… or sk_live_…).
X-Store-IdentifierRequiredYour business's store identifier, e.g. MCH10234, shown with your credentials.
Idempotency-KeyOptionalSame as the idempotencyKey body field. See Idempotency.
Content-TypeFor POSTapplication/json
  • Keep the secret on your server. Never put it in a mobile app, browser code or a public repository. The API doesn't allow calls from browsers.
  • All requests must use HTTPS.
  • Regenerating a key revokes the old one immediately.

IP whitelisting

You can ask us to accept API calls only from your servers' IP addresses. Our IT team adds them (single addresses or CIDR ranges) separately for test and live keys; you can see your list on the API keys page. Once a mode has addresses, calls from anywhere else are refused with 403 IP_NOT_ALLOWED, and the message shows the address we saw. If your servers sit behind a NAT gateway or load balancer, give us its outbound address.

To check your setup, call GET /ping. It returns which mode and gateway your keys use.

curl https://www.msiaoculus.com/api/v1/ping \
  -H "X-Api-Key: ok_test_7Kq2mWn4Xc8Rb3Hd9Tf6Ys2Lp" \
  -H "X-Api-Secret: $OCULUS_API_SECRET" \
  -H "X-Store-Identifier: MCH10234"
200 OK
{
  "statusCode": 200,
  "status": "SUCCESS",
  "data": {
    "mode": "TEST",
    "storeIdentifier": "MCH10234",
    "businessName": "Kola Foods",
    "gateway": "MPGS"
  }
}

Test and live

There is one base URL. Your key decides the mode.

ModeKey prefixWhat happens
Testok_test_Payments go to a test processing account. No real money moves. Use the test cards.
Liveok_live_Payments go to your business's live processing account. Available after IT approves your go-live.

Base URL: https://www.msiaoculus.com/api/v1

Test and live payments are kept apart: a test key can't see live payments, and the other way round.

POST/api/v1/payments

Create payment

Creates a payment and, unless 3-D Secure is needed, authorizes it straight away. With useGatewayAuthentication: true the payment usually comes back as PENDING_AUTHENTICATION with a redirectUrl; see 3-D Secure.

Request fields

FieldTypeRequiredDescription
orderIdstringRequiredYour order ID, up to 40 characters. Shown to you in reports and webhooks.
amountdecimalRequiredAmount in major units, e.g. 100.50. Most currencies allow two decimal places; JPY and XOF allow none.
currencystringRequiredISO 4217 three-letter code, e.g. NGN, USD.
customer.firstNamestringRequiredCustomer's first name.
customer.lastNamestringRequiredCustomer's last name.
customer.emailstringRequiredA valid email address.
customer.address.streetstringRequiredBilling street address.
customer.address.citystringRequiredCity.
customer.address.statestringRequiredState or province.
customer.address.countrystringRequiredISO 3166 alpha-3 code, e.g. NGA, SLE, USA.
customer.address.phoneNumberstringRequiredInternational format: +, country code, a space, then the number, e.g. +234 8031234567.
customer.address.zipPostalCodestringRequiredZIP or postal code.
customer.address.mobilePhonestringOptionalMobile number in the same format.
card.cardNumberstringRequiredCard number. Never log or store it.
card.expiryMonthstringRequiredTwo digits, 01 to 12.
card.expiryYearstringRequiredFour digits, e.g. 2029.
card.cvvstringRequired3 or 4 digit security code. Never store it.
card.nameOnCardstringOptionalDefaults to the customer's first and last name.
useGatewayAuthenticationbooleanRequiredtrue to have us run 3-D Secure. Strongly recommended; many issuers decline cards without it. Not yet available for CyberSource accounts.
captureOnAuthorizationbooleanOptionalDefault true: take the money as soon as it's authorized. Send false to authorize only and capture later.
returnUrlstringRequiredhttps URL the customer's browser returns to after 3-D Secure. In test mode, http://localhost is allowed.
idempotencyKeystringRequiredUnique key for this payment, up to 64 characters. Or send the Idempotency-Key header.

Request

curl -X POST https://www.msiaoculus.com/api/v1/payments \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: $OCULUS_API_KEY" \
  -H "X-Api-Secret: $OCULUS_API_SECRET" \
  -H "X-Store-Identifier: MCH10234" \
  -d '{
    "orderId": "1646794917",
    "amount": 100.50,
    "currency": "USD",
    "customer": {
      "firstName": "Ada",
      "lastName": "Okafor",
      "email": "ada.okafor@example.com",
      "address": {
        "street": "12 Admiralty Way",
        "city": "Lagos",
        "state": "LA",
        "country": "NGA",
        "phoneNumber": "+234 8031234567",
        "zipPostalCode": "106104"
      }
    },
    "card": {
      "cardNumber": "5123450000000008",
      "expiryMonth": "01",
      "expiryYear": "2039",
      "cvv": "100",
      "nameOnCard": "Ada Okafor"
    },
    "useGatewayAuthentication": true,
    "captureOnAuthorization": true,
    "returnUrl": "https://shop.example.com/checkout/complete",
    "idempotencyKey": "1199679095"
  }'

Response: 3-D Secure needed

201 Created
{
  "statusCode": 201,
  "status": "SUCCESS",
  "serverAuthentication": true,
  "redirectUrl": "https://www.msiaoculus.com/pay/v1/authenticate/Qm7vX2cK9pLr4sT8wYb3nZ6hJd5fGa2eR",
  "authenticationTransactionId": "auth-1",
  "payment": {
    "reference": "pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J",
    "orderId": "1646794917",
    "mode": "TEST",
    "gateway": "MPGS",
    "amount": 100.50,
    "currency": "USD",
    "status": "PENDING_AUTHENTICATION",
    "capturedAmount": 0,
    "refundedAmount": 0,
    "card": { "brand": "MASTERCARD", "bin": "512345", "last4": "0008" },
    "customer": { "firstName": "Ada", "lastName": "Okafor", "email": "ada.okafor@example.com" },
    "response": {},
    "authentication": { "transactionId": "auth-1", "status": "AUTHENTICATION_AVAILABLE" },
    "transactions": [
      { "id": "auth-1", "type": "AUTHENTICATION", "result": "SUCCESS", "gatewayCode": "AUTHENTICATION_AVAILABLE", "createdAt": "2026-11-18T14:15:09.112Z" }
    ],
    "createdAt": "2026-11-18T14:15:08.904Z",
    "updatedAt": "2026-11-18T14:15:09.512Z"
  }
}

Response: authorized without a redirect

When useGatewayAuthentication is false, or the card isn't enrolled in 3-D Secure and the gateway allows paying without it, the result comes back straight away. A decline is still 201: read payment.status.

201 Created
{
  "statusCode": 201,
  "status": "SUCCESS",
  "serverAuthentication": false,
  "payment": {
    "reference": "pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J",
    "orderId": "1646794917",
    "mode": "TEST",
    "gateway": "MPGS",
    "amount": 100.50,
    "currency": "USD",
    "status": "CAPTURED",
    "capturedAmount": 100.50,
    "refundedAmount": 0,
    "authorizationCode": "295526",
    "card": { "brand": "MASTERCARD", "bin": "512345", "last4": "0008" },
    "customer": { "firstName": "Ada", "lastName": "Okafor", "email": "ada.okafor@example.com" },
    "response": { "gatewayCode": "APPROVED", "acquirerCode": "00", "acquirerMessage": "Approved" },
    "transactions": [
      { "id": "pay-1", "type": "PAY", "amount": 100.50, "currency": "USD", "result": "SUCCESS", "gatewayCode": "APPROVED", "createdAt": "2026-11-18T14:15:09.733Z" }
    ],
    "createdAt": "2026-11-18T14:15:08.904Z",
    "updatedAt": "2026-11-18T14:15:09.733Z"
  }
}

Error response

400 Bad Request
{
  "statusCode": 400,
  "status": "ERROR",
  "error": {
    "cause": "INVALID_REQUEST",
    "explanation": "customer.address.phoneNumber must be in international format: +, country code, a space, then the number, e.g. +234 8031234567.",
    "field": "customer.address.phoneNumber",
    "validationType": "INVALID"
  }
}
REDIRECTredirectUrl

3-D Secure

When the create response has serverAuthentication: true, send the customer's browser to redirectUrl with a normal redirect (HTTP 302/303 or window.location). Don't open it in an iframe.

  1. Our page collects the browser details the bank needs and runs the bank's device check.
  2. The bank decides: approve without a challenge, or ask the customer to confirm (one-time code, banking app, etc.).
  3. We check the result with the gateway, authorize the payment if authentication passed, and send a webhook.
  4. The browser returns to your returnUrl. Confirm the outcome from your server before fulfilling the order.
Response fieldDescription
serverAuthenticationtrue when the customer must be redirected to complete 3-D Secure.
redirectUrlSingle-use link to our 3-D Secure page. Valid for 30 minutes; after that the payment becomes EXPIRED.
authenticationTransactionIdID of the authentication transaction on the payment.
// ASP.NET Core: after creating the payment on the server
if (result.GetProperty("serverAuthentication").GetBoolean())
    return Redirect(result.GetProperty("redirectUrl").GetString()!);

return RedirectToAction("Complete", new { reference = result.GetProperty("payment").GetProperty("reference").GetString() });

For CyberSource accounts, gateway-managed 3-D Secure isn't available in v1 yet: send useGatewayAuthentication: false, or the API answers 422 NOT_SUPPORTED.

GET/api/v1/payments/{transactionReference}

Retrieve payment

Returns the payment as it is now. transactionReference is the reference we returned (pay_…) or your orderId.

curl https://www.msiaoculus.com/api/v1/payments/pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J \
  -H "X-Api-Key: $OCULUS_API_KEY" \
  -H "X-Api-Secret: $OCULUS_API_SECRET" \
  -H "X-Store-Identifier: MCH10234"

A successful response is 200 with the same payment object as above. An unknown reference returns:

404 Not Found
{
  "statusCode": 404,
  "status": "ERROR",
  "error": {
    "cause": "NOT_FOUND",
    "explanation": "No payment with reference or orderId 'pay_unknown' for this store and mode.",
    "field": "transactionReference",
    "validationType": "INVALID"
  }
}
POST/api/v1/payments/{transactionReference}/capture

Capture

Takes the money for a payment created with captureOnAuthorization: false. Only AUTHORIZED payments can be captured. Authorizations usually expire after about 7 days, depending on the card issuer.

FieldTypeRequiredDescription
amountdecimalOptionalUp to the authorized amount. Defaults to the full amount.
idempotencyKeystringOptionalRecommended, so a retry can't capture twice.
Request
{ "amount": 100.50, "idempotencyKey": "cap-1646794917" }

Returns 200 with the payment, now CAPTURED.

POST/api/v1/payments/{transactionReference}/refund

Refund

Refunds all or part of a captured payment. You can refund several times until the captured amount is used up.

FieldTypeRequiredDescription
amountdecimalRequiredAmount to refund, up to what hasn't been refunded yet.
currencystringRequiredMust match the payment's currency.
reasonstringOptionalYour note, up to 200 characters.
idempotencyKeystringRequiredUnique per refund. Or send the Idempotency-Key header.
Request
{
  "amount": 50.00,
  "currency": "USD",
  "reason": "Customer returned one item",
  "idempotencyKey": "rf-1646794917-1"
}
200 OK
{
  "statusCode": 200,
  "status": "SUCCESS",
  "payment": {
    "reference": "pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J",
    "orderId": "1646794917",
    "status": "PARTIALLY_REFUNDED",
    "amount": 100.50,
    "currency": "USD",
    "capturedAmount": 100.50,
    "refundedAmount": 50.00,
    "transactions": [
      { "id": "pay-1", "type": "PAY", "amount": 100.50, "currency": "USD", "result": "SUCCESS", "gatewayCode": "APPROVED", "createdAt": "2026-11-18T14:15:09.733Z" },
      { "id": "refund-1", "type": "REFUND", "amount": 50.00, "currency": "USD", "result": "SUCCESS", "gatewayCode": "APPROVED", "createdAt": "2026-11-19T09:02:41.207Z" }
    ]
  }
}

The payment object is abbreviated here; the full object is returned.

POST/api/v1/payments/{transactionReference}/void

Void

Cancels an authorization, or a capture before it settles (usually the same day). After settlement, use a refund instead. Voiding a payment's PAY or AUTHORIZE transaction makes it VOIDED; voiding a separate CAPTURE returns it to AUTHORIZED.

FieldTypeRequiredDescription
transactionIdstringOptionalThe approved transaction to void (from payment.transactions). Defaults to the latest approved one.
idempotencyKeystringRequiredUnique per void. Or send the Idempotency-Key header.
Request
{ "transactionId": "pay-1", "idempotencyKey": "void-1646794917" }

Returns 200 with the payment. A void the gateway refuses (for example, already settled) returns 402 with cause: "DECLINED".

Return URL

After 3-D Secure we redirect the customer's browser to your returnUrl with these query parameters:

GET
https://shop.example.com/checkout/complete?reference=pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J&orderId=1646794917&status=CAPTURED

The return URL is for the customer's browser only. Anyone can type a URL with status=CAPTURED, so never fulfil an order from these parameters. Call Retrieve payment from your server, or use the webhook.

Webhooks

Add a webhook URL under API and webhooks on your application page. We then send a signed POST when something happens to a payment:

notificationTypeSent when
PAYMENTA payment is authorized, captured, declined, fails, expires or is voided.
AUTHENTICATION3-D Secure finishes, whether it passed or failed.
REFUNDA full or partial refund is approved.
TESTYou select Send test notification in the dashboard.

Delivery and retries

Reply with any 2xx status within 15 seconds. Otherwise we retry after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours, then stop. Notifications can arrive more than once or out of order: use notificationId to ignore duplicates, and treat the payment status from Retrieve payment as the final word. Your URL must be https and reachable on the public internet.

Headers

HeaderDescription
X-Oculus-Signaturet=<unix seconds>,v1=<hex HMAC-SHA256>. See below.
X-Oculus-Notification-IdSame as notificationId in the body.
X-Oculus-Notification-TypePAYMENT, AUTHENTICATION, REFUND or TEST.
X-Oculus-Attempt1 for the first try, then 2, 3 and so on.

Verify the signature

Compute HMAC-SHA256 of {t}.{raw request body} using your webhook signing secret (whsec_…, shown once in the dashboard), hex-encode it, and compare it with v1 in constant time. Reject the request if they differ or if t is more than 5 minutes old. Use the raw body exactly as received, before any JSON parsing.

using System.Security.Cryptography;
using System.Text;

static bool IsValidOculusSignature(string header, string rawBody, string secret)
{
    var parts = header.Split(',').Select(p => p.Split('=', 2)).Where(p => p.Length == 2)
                      .ToDictionary(p => p[0].Trim(), p => p[1].Trim());
    if (!parts.TryGetValue("t", out var t) || !parts.TryGetValue("v1", out var v1)) return false;
    if (!long.TryParse(t, out var ts) || Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - ts) > 300) return false;

    var expected = Convert.ToHexString(HMACSHA256.HashData(
        Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes($"{t}.{rawBody}"))).ToLowerInvariant();
    return CryptographicOperations.FixedTimeEquals(Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(v1));
}

Payloads

{
  "notificationId": "ntf_V7nq2KxR8mLw3Tb9Hc5Yd4Jf",
  "notificationType": "PAYMENT",
  "mode": "TEST",
  "storeIdentifier": "MCH10234",
  "order": {
    "id": "1646794917",
    "reference": "pay_8fK2mQx7Lw3Rn9Tb5Vc4Hy6J",
    "amount": 100.50,
    "currency": "USD",
    "status": "CAPTURED",
    "totalCapturedAmount": 100.50,
    "totalRefundedAmount": 0
  },
  "transaction": {
    "id": "pay-1",
    "type": "PAY",
    "amount": 100.50,
    "currency": "USD",
    "authorizationCode": "295526"
  },
  "result": "SUCCESS",
  "response": {
    "gatewayCode": "APPROVED",
    "acquirerCode": "00",
    "acquirerMessage": "Approved"
  },
  "timeOfRecord": "2026-11-18T14:15:14.415Z"
}

Idempotency

Networks fail. If you don't get a response, send the same request again with the same idempotency key: you get the original result instead of a second charge.

  • Keys are scoped to your store and mode, and to the operation (create, capture, refund, void).
  • Reusing a key with different values (a different amount, say) returns 409 IDEMPOTENCY_MISMATCH.
  • If the first request is still running, a repeat returns 409 CONFLICT; wait a moment and check the payment.
  • If the gateway couldn't be reached (502 GATEWAY_UNAVAILABLE) on a capture, refund or void, retrying with the same key tries again. For a new payment, check it with Retrieve payment first.

Testing

Use your test key with these cards. On MPGS test accounts, the expiry date chooses the outcome and the CVV chooses the security code result. The exact behaviour comes from the gateway's test simulator, so results can vary slightly between acquirers.

CardNumber
Mastercard5123 4500 0000 0008
Mastercard (2-series)2223 0000 0000 0007
Visa4508 7500 1574 1019
Expiry date → gatewayCode
ExpiryResult
01/2039APPROVED
05/2039DECLINED
04/2027EXPIRED_CARD
08/2028TIMED_OUT
01/2037ACQUIRER_SYSTEM_ERROR
02/2037UNSPECIFIED_FAILURE
05/2037UNKNOWN
CVV → security code result
CVVResult
100MATCH
101NOT_PROCESSED
102NO_MATCH

With useGatewayAuthentication: true, test cards go through Mastercard's 3-D Secure test environment, where the challenge page is simulated.

CyberSource test accounts: use 4111 1111 1111 1111 with any future expiry date and any 3-digit CVV for an approval.

Statuses and codes

Payment status

statusMeaning
PENDING_AUTHENTICATIONWaiting for the customer to complete 3-D Secure.
AUTHORIZEDApproved and reserved on the card, not yet captured.
CAPTUREDApproved and captured. The money will settle to you.
PARTIALLY_REFUNDEDPart of the captured amount has been refunded.
REFUNDEDThe whole captured amount has been refunded.
VOIDEDCancelled before settlement.
DECLINEDThe issuer or acquirer declined it. See response.gatewayCode.
AUTHENTICATION_FAILED3-D Secure failed or wasn't allowed for this card.
FAILEDThe gateway rejected the request or couldn't be reached.
EXPIREDThe customer didn't finish 3-D Secure within 30 minutes.

Gateway response codes

response.gatewayCode explains the outcome; response.acquirerCode is the raw code from the acquirer, when there is one.

gatewayCodeStatusMeaning
APPROVEDAUTHORIZED / CAPTUREDApproved.
DECLINEDDECLINEDDeclined by the issuer.
INSUFFICIENT_FUNDSDECLINEDNot enough funds.
EXPIRED_CARDDECLINEDThe card has expired.
DECLINED_INVALID_CSCDECLINEDThe security code was wrong (CyberSource).
TIMED_OUTDECLINEDThe issuer didn't answer in time. Safe to try again.
ACQUIRER_SYSTEM_ERRORDECLINED / FAILEDThe acquirer had a problem. Try again later.
UNSPECIFIED_FAILUREDECLINED / FAILEDThe payment failed for an unspecified reason.
UNKNOWNFAILEDThe outcome couldn't be confirmed. Check the payment before retrying.
EXPIREDEXPIRED3-D Secure wasn't completed in time.

API errors

HTTPcauseMeaning
400INVALID_REQUESTA field is missing or invalid. error.field names it; validationType is MISSING or INVALID.
401UNAUTHORIZEDWrong or expired key, secret or store identifier.
402DECLINEDA capture, refund or void was declined by the gateway.
403FORBIDDENYour business or processing account isn't active for this mode.
403IP_NOT_ALLOWEDThe request came from an address that isn't on your IP whitelist.
404NOT_FOUNDNo payment with that reference for this store and mode.
409INVALID_STATEThe payment's status doesn't allow this (e.g. refunding an authorization).
409IDEMPOTENCY_MISMATCH / CONFLICTSee Idempotency.
422NOT_SUPPORTEDThe feature isn't available for your account (e.g. 3-D Secure on CyberSource).
429—Too many requests. Slow down and retry.
502GATEWAY_UNAVAILABLEThe card gateway couldn't be reached or didn't confirm the outcome.
503SANDBOX_UNAVAILABLENo test processing account is available. Contact support.

Going live

  1. Run test payments that approve, decline and go through 3-D Secure, plus a refund and a void.
  2. Check that your server confirms each result with Retrieve payment or a verified webhook before fulfilling orders.
  3. On your application page, select Request go-live. IT reviews your test payments and switches you to live.
  4. Generate live credentials, put them in your server's secret store, and swap them in. Nothing else changes.

Questions? Email info@msiaoculus.com with your store identifier and the payment reference. Never send API secrets or full card numbers.