OPay Callback Notification Signature

Whenever the status of any of your transaction has been updated, e.g. a reference code payment has been paid, OPay will keep you informed at your designated callBackUrl. Since anyone can get hold of your endpoint and attempt to send you phony event objects for malicious purposes (e.g. to see if they can mark their subscription to your product as renewed just in case you aren't running any verifications on the transaction reference), it is important to verify that callbacks originate from OPay.

You can do any or both of the below to verify callbacks from OPay:

  • Watch the IPs and accept callbacks only from our IPs.
  • Validate the Signature as described in the section that follows.

In this page, you will learn:

  1. How to calculate the signature of the received callback.
  2. How to validate OPay callback signature.

Callback Signature

Header contains the "Signature" , "MerchantId" and "RequestTimestamp"

Signature is calculated using SHA-512 HMAC signed with your Private Key for the concatenation of request timestamp and request body:
See API Calls Signature v2 section for more details.

Callback Request

-Request Parameters:

  1. Header: Authorization(API Calls Signature v2), MerchantId and RequestTimestamp
  2.                         
                                Authorization: {signature}
                                MerchantId   : 256612345678901
                                RequestTimestamp : 1631106688000
                            
                        
  3. Json object containing the transaction information:
  4.     
                            {
                                "amount":{
                                            "currency":"EGP",
                                            "total":400
                                },
                                "country":"EG",
                                "failureCode":"01582",
                                "failureReason":"Invalid CVV/CVC.",
                                "notifyId":"68d9b42c1e694ebc921af92b76804d23",
                                "orderNo":"211005140885652282",
                                "reference":"92631092",
                                "status":"FAIL",
                                "timestamp":1633411815591,
                                "type":"MACQUIRING_CALLBACK"
                                "extras":{}
                            }
        
    

HTTP POST Parameters

-Here is a detailed description for the parameters you need to complete the POST request:

Parameter type required Description
notifyId String required the callback message id.
reference String required the unique merchant payment order number.
amount
total String required Amount(cent unit).
currency String required currency type.See full list here
orderNo String required the unique Opay payment order number.
country String required Country Code.See full list here
status enum required [INITIAL, PENDING, SUCCESS, FAIL, CLOSE]
timestamp Long required callback message created timestamp.
type enum required [MACQUIRING_CALLBACK]
failureCode String optional payment fail error code, not blank when status [FAIL]
failureReason String optional payment fail error message, not blank when status [FAIL]
extras Map optional extra,key(String)-value(String) pairs

See Also

User Profile 12 messages

Recent Notifications
Another purpose persuade Due in 2 Days
+28%
Would be to people Due in 2 Days
+50%
-27%
The best product Due in 2 Days
+8%