Query Payment Status

OPay will make sure that you will be kept updated with the status of your payments. You can retrieve your payment information when needed.

OPay Query Payment Status

After a given payment transaction has been issued by one of your clients using OPay Payment APIs, we will make sure that you will be kept updated with the status of your payments. OPay delivers several solutions to keep our valued merchants informed once the status of their respective transactions has been updated. For our valued merchants’ convenience, and not to keep them at the blind spot unless informed by OPay notification callback, OPay provides an informative API to serve merchants who wish to pull the status of their transactions whenever needed. Whenever you need to pull the information of a given payment, you can use cashier payment status API. You may need to pull the payment information when you need to:

  • Inform your client about his/her payment status.
  • Apply cross verification when receiving a callback on your callback URL.

In case you are still in development phase, you can call cashier payment status API using POST at the following staging endpoint API point URL




Once you are ready for production, you should use the following production API endpoint URL instead




  1. Header: Authorization(API Calls Signature), MerchantId
                                Authorization    : Bearer {signature}
                                MerchantId       : 256612345678901

  3. Json object containing the transaction information:
                                "reference": "96315454",

HTTP POST Parameters

Detailed description of the parameters that you need to incorporate into your POST request are given in the table below.

Parameter type required Description
reference String required (if no orderNo provide) Unique merchant payment order number.
orderNo String required (if no reference provide) Unique Opay payment order number.
country String required Country Code.

An example call of cashier payment status request is given below.

                            class QueryPaymentStatusController
                                private $secretkey;
                                private $merchantId;
                                private $url;

                                public function __construct() {
                                    $this->merchantId = '281821110129700';
                                    $this->secretkey = 'OPAYPRV*******0187828';
                                    $this->url = 'https://testapi.opaycheckout.com/api/v1/international/cashier/status';

                                public function test(){
                                    $data = [
                                        'country' => 'NG',
                                        'reference' => '041233981115'
                                    $data2 = (string) json_encode($data,JSON_UNESCAPED_SLASHES);
                                    $auth = $this->auth($data2);
                                    $header = ['Content-Type:application/json', 'Authorization:Bearer '. $auth, 'MerchantId:'.$this->merchantId];
                                    $response = $this->http_post($this->url, $header, json_encode($data));
                                    $result = $response?$response:null;
                                    return $result;

                                private function http_post ($url, $header, $data) {
                                    if (!function_exists('curl_init')) {
                                        throw new Exception('php not found curl', 500);
                                    $ch = curl_init();
                                    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
                                    curl_setopt($ch, CURLOPT_URL, $url);
                                    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                                    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                                    curl_setopt($ch, CURLOPT_HEADER, false);
                                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                                    curl_setopt($ch, CURLOPT_POST, true);
                                    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
                                    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
                                    $response = curl_exec($ch);
                                    $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                                    if (200 != $httpStatusCode) {
                                        print_r("invalid httpstatus:{$httpStatusCode} ,response:$response,detail_error:" . $error, $httpStatusCode);
                                    return $response;
                                public function auth ( $data ) {
                                    $secretKey = $this->secretkey;
                                    $auth = hash_hmac('sha512', $data, $secretKey);
                                    return $auth;


                                # importing the requests library
                                import requests
                                # CashierAPI Endpoint
                                URL = "https://testapi.opaycheckout.com/api/v1/international/cashier/status"

                                # defining a params dict for the parameters to be sent to the API
                                PaymentData = {
                                    'reference'    : '12312321324',
                                    'country'  : 'NG',
                                # Prepare Headers
                                headers = {
                                    'Content-Type' : 'application/json',
                                    'Accept'       : 'application/json',
                                    'Authorization': 'Bearer Public Key',
                                    'MerchantId'   : '256612345678901'
                                # sending post request and saving the response as response object
                                status_request = requests.post(url = URL, params = json.dumps(PaymentData), headers=headers)

                                # extracting data in json format
                                status_response = status_request.json()
                                const request = require('request');
                                var sha512 = require('js-sha512');
                                const formData = {
                                  "country": "NG",
                                  "reference": "041233981112"

                                var privateKey = "OPAYPRV*******0187828"

                                var hash = sha512.hmac.create(privateKey);
                                hmacsignature = hash.hex();
                                    url: 'https://testapi.opaycheckout.com/api/v1/international/cashier/status',
                                    method: 'POST',
                                    headers: {
                                      'MerchantId': '256621051120756',
                                      'Authorization': 'Bearer '+hmacsignature
                                    json: true,
                                    body: formData
                                  }, function (error, response, body) {
                                    console.log('body: ')

                                curl --location --request POST 'https://testapi.opaycheckout.com/api/v1/international/cashier/status' \
                                --header 'MerchantId: 256621051120756' \
                                --header 'Authorization: Bearer 38017496e*******2ab0297d1de8905cb7d85a043d9084254e61a8da6093b6f155550ff51891dca9f9889a' \
                                --header 'Content-Type: application/json' \
                                --data-raw '{
                                    "reference": "98354135491"
                            import com.google.gson.Gson;
                            import org.apache.commons.codec.binary.Hex;
                            import javax.crypto.Mac;
                            import javax.crypto.spec.SecretKeySpec;
                            import java.io.BufferedReader;
                            import java.io.InputStreamReader;
                            import java.io.OutputStream;
                            import java.net.HttpURLConnection;
                            import java.net.URL;
                            import java.nio.charset.StandardCharsets;
                            import java.util.TreeMap;

                            public class QueryPaymentStatus {

                                private static final String privateKey = "OPAYPRV*******0187828";

                                private static final String endpoint = "https://testapi.opaycheckout.com";

                                private static final String merchantId = "256621051120756";

                                public static void main(String[] args) throws Exception {
                                    String addr = endpoint + "/api/v1/international/cashier/status";
                                    Gson gson = new Gson();
                                    TreeMap order = new TreeMap<>();
                                    order.put("reference", "4fdedd52-7f48-442d-9db4-e1460a4e5ca5");
                                    order.put("country", "NG");

                                    String requestBody = gson.toJson(order);
                                    String oPaySignature = hmacSHA512(requestBody, privateKey);

                                    URL url = new URL(addr);
                                    HttpURLConnection con = (HttpURLConnection)url.openConnection();
                                    con.setRequestProperty("Content-Type", "application/json; utf-8");
                                    con.setRequestProperty("Authorization", "Bearer "+oPaySignature);
                                    con.setRequestProperty("MerchantId", merchantId);
                                    OutputStream os = con.getOutputStream();
                                    byte[] input = requestBody.getBytes(StandardCharsets.UTF_8);
                                    os.write(input, 0, input.length);
                                    BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8));
                                    StringBuilder response = new StringBuilder();
                                    String responseLine = null;
                                    while ((responseLine = br.readLine()) != null) {

                                    //close your stream and connection

                                public static String hmacSHA512(final String data, final String secureKey) throws Exception{
                                    byte[] bytesKey = secureKey.getBytes();
                                    final SecretKeySpec secretKey = new SecretKeySpec(bytesKey, "HmacSHA512");
                                    Mac mac = Mac.getInstance("HmacSHA512");
                                    final byte[] macData = mac.doFinal(data.getBytes());
                                    byte[] hex = new Hex().encode(macData);
                                    return new String(hex, StandardCharsets.UTF_8);

                            using System;
                            using System.IO;
                            using System.Linq;
                            using System.Net;
                            using System.Text;
                            using Newtonsoft.Json;
                            namespace OPayRequest
                                public class Program
                                    static void Main(string[] args)
                                        PostJson("https://testapi.opaycheckout.com/api/v1/international/cashier/status", new opay_request
                                            reference    = '12312321324',
                                            country  = 'NG',

                                    private static void PostJson(string uri, opay_request postParameters)
                                        string postData = JsonConvert.SerializeObject(postParameters);
                                        byte[] bytes = Encoding.UTF8.GetBytes(postData);
                                        var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
                                        httpWebRequest.Method = "POST";
                                        httpWebRequest.ContentLength = bytes.Length;
                                        httpWebRequest.ContentType = "text/json";
                                        using (Stream requestStream = httpWebRequest.GetRequestStream())
                                            requestStream.Write(bytes, 0, bytes.Count());
                                        var httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
                                        if (httpWebResponse.StatusCode != HttpStatusCode.OK)
                                            string message = String.Format("GET failed. Received HTTP {0}", httpWebResponse.StatusCode);
                                            throw new ApplicationException(message);

                                public class opay_request
                                    public string reference { get; set; }
                                    public string orderNo { get; set; }
                                    public string country { get; set; }



Header must contain the "Signature" , "MerchantId"

Signature is calculated using SHA-512 HMAC signed with your Private Key for the request body Json object. See Signature Calculator section for more details.

Payment Status Response

Sample Query Payment Status API Response

                                "code": "00000",
                                "message": "SUCCESSFUL",
                                "data": {
                                    "reference": "1633759282000",
                                    "orderNo": "211009140896593010",
                                    "status": "INITIAL",
                                    "vat": {
                                        "total": 0,
                                        "currency": "NGN"
                                    "amount": {
                                        "total": 400,
                                        "currency": "NGN"
                                    "createTime": 1633788085000

Response Parameters Description

Parameter type Description example
reference String Unique Merchant's payment order number. 1001000
orderNo String Unique Opay's payment order number. 211009140896593010
createTime String payment created timestamp. 1633788085000


total Integer amount(cent unit). 400
currency String currency type.See full list here NGN
total Integer amount(cent unit). 10
currency String currency type.See full list here NGN
failureCode String fail error code. payment fail error code, not blank when status [FAIL/CLOSE]
failureReason String fail error message. payment fail error message, not blank when status [FAIL/CLOSE]
isVoided Boolean If the payment order has been voided, there will be an isVoided parameter in the response, its value is true or false. This parameter is only in the query status response of the transaction which has been initiated void. "isVoided":true or false

Error Handling

After submitting an API call to OPay, you receive a response back to inform you that your request was received and processed. A successful OPay API should return a status code 00, meanwhile, in a situation where any payment processing error occurred, you will receive an error code with a message to describe the reason of the error. A sample error response can be found below.

                            "code": "02006",
                            "message": "payment not found."

Depending on the HTTP status code of the response, you should build some logic to handle any errors that a request or the system may return. A list of possible potential error codes that you may receive can be found below.

Error Code Error Message
02000 authentication failed.
02001 request params not valid.
02006 not found.
02002 merchant not configured with this function.
02007 merchant not available.
50003 service not available, please try again.

What's Next?

User Profile 12 messages

James Jones
Application Developer
Recent Notifications
Another purpose persuade Due in 2 Days
Would be to people Due in 2 Days
The best product Due in 2 Days