Processing Response From Payment Gateway


Next Page: Moving to Production
Previous Page: Encryption Library

The response returned from the Payment Gateway would be in a field called data. This would be encrypted using the same set of AES - IV & Secret Keys and hence would need to be decrypted using HesabeCrypt library’s decrypt function. The value after decryption would be like on the right.

Sample Response

{
    "status": true,
    "code": 1,
    "message": "Transaction Success",
    "response": {
        "data": {
            "resultCode": "CAPTURED",
            "amount": 10,
            "paymentToken": "1569830677725743478",
            "paymentId": "100201927384634224",
            "paidOn": "2019-09-30 11:05:16",
            "orderReferenceNumber": null,
            "variable1": null,
            "variable2": null,
            "variable3": null,
            "variable4": null,
            "variable5": null,
            "method": 1,
            "administrativeCharge": "5"
        }
    }
}

Response Parameters

Field Type Description
status Boolean Payment status (true - success; false - failure)
resultCode String Success transactions value are "CAPTURED" or "ACCEPT" or "SUCCESS"
amount Numeric Amount must be greater than zero
paymentToken Numeric [14 digits] Payment Token returned from Hesabe
paymentId Alphanumeric Payment Id returned from Hesabe
paidOn Alphanumeric [36] Date Time of Payment
orderReferenceNumber Alphanumeric Custom user parameter which was passed in request
variable1 Alphanumeric [100] Custom user parameter which will be included in the response when it returns
variable2 Alphanumeric [100] Custom user parameter which will be included in the response when it returns
variable3 Alphanumeric [100] Custom user parameter which will be included in the response when it returns
variable4 Alphanumeric [100] Custom user parameter which will be included in the response when it returns
variable5 Alphanumeric [100] Custom user parameter which will be included in the response when it returns
method Numeric 1 or 2 (KNET=1 and MPGS =2)
administrativeCharge Numeric Administrative Charge

Error Codes

Code Description
0 Invalid Response
422 Invalid Input
500 Invalid Token
501 Invalid Merchant
503 Invalid Merchant Service
504 Invalid Merchant Login Credentials
505 Invalid Payment Token
506 Invalid Request Data
507 Transaction Error

Based on the status (success or failure), appropriate messages can be shown by the client on the confirmation page.






Next Page: Moving to Production
Previous Page: Encryption Library