Token Info By User API

In this page, you will learn how to get all information about active Card Token for a specific customer.

Token Info By User API

To test your Token Info By User API, you need to request using the POST method in our sandbox environment.
-Here is the request URL:

                
                https://sandbox-cashierapi.opaycheckout.com/api/v1/international/token/query
            
                    

-Once you have a fully tested payment flow and you are ready for production, Use the following production API endpoint URL instead

                
                https://cashierapi.opaycheckout.com/api/v1/international/token/query
            
                    

-Request Parameters:

  1. Header: Bearer and private key Signature
  2.                         
                                Authorization: "Bearer" + private key signature
                                MerchantId   : 256612345678901
                            
                        
  3. Json object containing the information:
  4.     
                            {
                                "customerId": "xxx"
                            }
        
    

HTTP POST Parameters

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

Parameter type required Description
customerId String required Merchant unique user id.

Token Info By User Response

-Response Parameters:

the parameters contained in the response received whenever you call the API as a JSON Object.

                
                    {
                        "code":"00000",
                        "message":"SUCCESSFUL",
                        "data":{
                            "customer":{
                            "customerId":"121111113",
                            "customerName":"20123111111",
                            "customerEmail":"123@1231.com",
                            "customerMobile":"20123111111"
                        },
                        "cardTokens":[
                            {
                                "opayToken":"OPAY_TOKEN_bf8593c1693546ea83743e4d433c5bf5",
                                "brand":"VISA",
                                "createTimestamp":1637822753,
                                "lastFourDigits":"7411",
                                "firstSixDigits":"450875"
                            }
                            ]
                        }
                    }
            
                    

-Here is a detailed description for the parameters received in the response:

Parameter type Description example
cardTokens
opayToken String Card unique token. OPAY_TOKEN_bf8593c1693546ea83743e4d433c5bf5
brand String Card brand. VISA
expiryYear String Expiry Year. 26
expiryMonth String Expiry Month. 02
createTimestamp String Token create time. 1637822753
lastFourDigits String Card number last 4 digits. 7411
firstSixDigits String Card number first 6 digits. 450875
customer
customerId String User unique id. 121111113
customerName String User name. name1
customerEmail String User Email . 123@1231.com
customerMobile String User mobile. 20123111111

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": "20000",
                            "message": "Duplicate merchant order number",
                            "data": null
                        }
                    
                

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. A full list of all possible error codes can be found in the Error Codes section.

Error Code Error Message
09 Time out.
90 System failure.
91 Refund error, please try again later.
96 Search order error, please try again later.
97 Create checkout session failed.
98 Invalid request header with requestId.
99 Request channel parameters are not valid.
20000 Duplicate merchant order number.

What's Next?

User Profile 12 messages

James Jones
Application Developer
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%