Skip to main content
This guide covers the three ways to collect a payment from a customer with the Hyparrow API: charging a card, redirecting to OPay, and generating a USSD dial code. All of them settle into your Hyparrow account; pick whichever suits your checkout. All endpoints below live under the base path /api/v1 and are authenticated with your API key credentials:
Base URL is https://api.hyparrow.cloud/api/v1 in production. To build and test without moving real money, point at the Sandboxhttps://sandbox.hyparrow.cloud/api/v1 — using a pk_test_ key. See Card test values below.

Card payments

Charging a card is a stateful flow. You start a purchase; depending on the card, it may complete immediately or require the cardholder to confirm a one-time password (OTP). You then submit the OTP to finish the charge.
The flow is driven by the responseCode on each response:
Amounts for card payments are sent in naira as a string (for example "1000" for ₦1,000). Hyparrow converts to the minor unit (kobo) on your behalf before reaching the card network. Card details are encrypted server-side before they ever leave Hyparrow — you send the raw PAN/PIN/expiry/CVV over TLS and never store them yourself.

Charge a card end-to-end

1

Initiate the purchase

Call POST /card-payments/purchase with the customer, amount and card details. Generate a unique transactionRef per attempt.
expiryDate is YYMM (so 2504 is April 2025).A card that needs an OTP returns responseCode: "T0" and the identifiers you need for the next step (paymentId, transactionId):
Response — OTP required
If the card clears without an OTP, you instead get responseCode: "00" and the payment is already complete — skip straight to checking status.
2

Authenticate the OTP

Collect the OTP from the cardholder and submit it with POST /card-payments/authenticate-otp, echoing the paymentId and transactionId from the previous response.
cURL
A responseCode of 00 means the charge succeeded:
Response — success
If the cardholder didn’t receive the OTP, request a new one with POST /card-payments/resend-otp:
Resend OTP
3

Confirm the status

Verify the outcome any time with GET /card-payments/status, passing the transactionRef and amount (in naira) as query parameters.
cURL
Response
To list all card transactions for the authenticated client, use GET /card-payments/transactions.

Card edge cases

The first purchase response carries responseCode: "T0" (or S0). The charge is not yet complete — you must collect the OTP and call authenticate-otp. Until then the transaction is processing.
Any responseCode other than 00, T0 or S0 is a decline. The response surfaces the network’s message, and an errors array yields 422 Unprocessable Entity. Show the cardholder the reason and ask them to try another card.
If you lose the response or aren’t sure of the outcome, poll GET /card-payments/status. It returns the authoritative state from the card network and updates the stored transaction. Treat anything that isn’t 00 as not-yet-paid.

OPay

OPay is a redirect flow: you initialize the payment, send the customer to the returned URL to pay, then confirm the result.
1

Initialize the payment

POST /payments/opay/initialize with the amount (in kobo, as an integer). A transactionReference is generated for you if you omit it.
cURL
Response
responseCode 09 is the normal “redirect required” result. Send the customer to redirectUrl to complete payment.
2

Confirm the result

After the customer returns, verify the payment with POST /payments/opay/status, passing the reference.
cURL
Response
paid: true (responseCode: "00") means the payment settled. Until then, keep the order pending.

USSD

USSD lets a customer pay by dialling a short code on their phone. You fetch the list of supported banks, then generate a dial code for the chosen bank.
1

List supported banks

GET /payments/ussd/issuers returns the banks that support USSD payments, each with the bankCode you’ll pass when generating the code.
cURL
Response
2

Generate the dial code

POST /payments/ussd/generate with the amount (in naira, as a string) and the chosen bankCode. A merchantTransactionReference is generated if you omit it.
cURL
Response
Show the customer the returned ussdCode and ask them to dial it to complete the payment.

Testing in the sandbox

In the Sandbox every provider is simulated, so you can run all three flows end-to-end without real money. Use a pk_test_ key against https://sandbox.hyparrow.cloud/api/v1.
Card test values
  • Success card: 5060990580000217499 (always approved)
  • Decline card: 0000000000000000000 (always declined)
  • OTP: 123456 succeeds; any other OTP is rejected
  • Magic amounts (any other card): an amount ending in .01 forces failed, .99 forces pending, anything else settles as success