Skip to main content

Signature


How it works​

In Amanpay, digital signatures are used to ensure payment security. That is why it's required that you always add the signature to your requests and be able to verify signatures in responses and callbacks from Amanpay.

The signature is placed in the Authorization header of a request and represents a SHA-512 hash generated from request parameter values and your secret key.


Signature generation for request​

Among the parameters of your request, select the parameters necessary for generating the signature and place them in the required order:

Parameter order​

RequestParameter sequence
Purchaseamount → currency → merchantId → paymentId → {paymentMethodNumber}
Payoutamount → currency → merchantId → paymentId → {recipientAccountNumber}
StatusmerchantId → paymentId → transactionId
SpecifytransactionId → operationId
BalancemerchantId

Method-specific parameters​

RequestSelectionParameter
PurchasejazzcashjazzCashNumber
easypaisaeasypaisaNumber
bkashbkashNumber
nagadnagadNumber
raastqrraastQRNumber
Payoutjazzcash / easypaisa / bkash / nagadrecipientMobileNumber
bank transferrecipientBankAccNumber

The resulting parameter string is concatenated with secretKey:

SHA512({parameter sequence} + secretKey)

note
  1. Parameters must be concatenated in the exact order defined for the corresponding API operation.

  2. Do not add spaces, separators, or additional characters between parameters.

  3. Amount is formatted with exactly two decimal places. For example: 10 → 10.00


Generate a signature​

Use the sandbox below to generate an SHA-512 signature for different API operations.

Signature Sandbox


Signature verification​

The signature is verified using the same parameters and parameter order used during signature generation.

To verify a signature received from Amanpay:

  1. Concatenate the required parameter values without separators and in the specified order.
  2. Append your secret secretKey.
  3. Calculate the SHA-512 hash.
  4. Compare the result with the authorization value received from Amanpay.

PLease check the examples below. For all of them secretKey is test

Purchase response example
Response
{
"transactionId": "1122257",
"paymentID": "ORDER_100001_185_329",
"status": "PENDING",
"amount": 500,
"currency": "PKR",
"redirectUrl": "https://page.amanpay.io/checkout/c3fb5ff0-b337-11f1-a028-06c956c96cf5",
"paymentType": "purchase"
}
Example
500.00PKR138ORDER_100001_185_3291122257PENDINGtest
String to sign
amount → currency → merchantId → paymentId → transactionId → status + secretKey
SHA-512
6ff05ba203313c419bea2fdbcf23c7f64b9c7e6ce42797c24792722c0b57865ca95ed19ae4e65be4099cc69d6b535e7514a2d9b864a666fdd77a79a858b91dd6
Payout response example
Response
{
"transactionId": "1122305",
"paymentID": "ORDER_100001_524_517",
"status": "PENDING",
"amount": 500,
"currency": "PKR",
"paymentType": "payout"
}
Example
500.00PKR138ORDER_100001_524_5171122305PENDINGtest
String to sign
amount → currency → merchantId → paymentId → transactionId → status + secretKey
SHA-512
2ae0ec566bdab528dbe6eb39c0adf615232a93db95ceef06a97ce2d2ce556076c7b723a18724e30856d6230522e5839ce8b22ed061a7983f65a7bad9c34468da
FAILED Check status response example
Response
{
"transactionId": "1122257",
"paymentID": "ORDER_100001_185_329",
"status": "FAILED",
"amount": 500,
"currency": "PKR",
"paymentType": "purchase",
"errorCode": "GENERAL_ERROR",
"errorMessage": "An unexpected error occurred while processing your request"
}
Example
500.00PKR138ORDER_100001_185_3291122257FAILEDtest
String to sign
amount → currency → merchantId → paymentId → transactionId → status + secretKey
SHA-512
41f98ae5329916e5f040c5e50d50e6d1e19847859cbde5e3c52c7b3463ac8205f67118d9ee2753e6d86f22561b908e60f32105667a4d7a7494323049da8b9e5c
FAILED Callback example
Response
{
"transactionId": "1122257",
"paymentID": "ORDER_100001_185_329",
"status": "FAILED",
"amount": 500,
"currency": "PKR",
"paymentType": "purchase",
"errorCode": "GENERAL_ERROR",
"errorMessage": "An unexpected error occurred while processing your request"
}
Example
500.00PKR138ORDER_100001_185_3291122257FAILEDtest
String to sign
amount → currency → merchantId → paymentId → transactionId → status + secretKey
SHA-512
80e9ee3659299d9bb1ecae3e491d7c6ed2b8f768fefbb356a0ad4b2281b70bfe0de36d9b42428955f7971bdf02726cd771827a1b30937a91a1f8b5fd6855786f
SUCCESS Callback example
Response
{
"transactionId": "1122257",
"paymentID": "ORDER_100001_185_329",
"status": "SUCCESS",
"amount": 500,
"currency": "PKR",
"paymentType": "purchase"
}
Example
500.00PKR138ORDER_100001_185_3291122257SUCCESStest
String to sign
amount → currency → merchantId → paymentId → transactionId → status + secretKey
SHA-512
137bf0d46d50ce052889e5454b9c7a50a4c18ed544789a3c5a60558cc2e8ec5af8f49e040f910cf32aa6b5eb8ae1fdb1ffb60441d1daf67378a3826460cbb1ed
PENDING with QR callback example
Response
{
"additional_data": {
"QrData": "000201010212287600327c50dcc6361047678afb7d2d5c9855250108BKIPPKKA0224PK69BKIP999990348338499652045818530358654032005802PK5909ASSAN PAY6007Karachi64300002EN0109ASSAN PAY0207Karachi62500214+92-34833849960520251915202609111420210804PURP847600327c50dcc6361047678afb7d2d5c98552501367c50dcc6-3610-4767-8afb-7d2d5c98552563042D66"
},
"operationId": 1250846,
"transactionId": 1072804,
"status": "PENDING"
}
Example
10728041250846test
String to sign
`transactionId` → `operationId`
SHA-512
7a56f09eaccc64aaa583c18e318f5d6482887537c1f225a20c1b9f942ef79d94af323a7a0cd2cee2a88209bac8e89a6a305ee48f0a9ada489576a250fcd37070
SPECIFICATION with payment data callback example
Response
{
"additional_data": {
"PaymentData": "01354315044"
},
"additional_fields": [
"TrxId"
],
"operationId": 1278218,
"transactionId": 1097333,
"status": "SPECIFICATION"
}
Example
10973331278218test
String to sign
`transactionId` → `operationId`
SHA-512
c85c7013dcba9edd91c28331ef7db047f1f69046e750386854aafa585219e5fea8b91e62389588615b45961be753b781999d50a3eea4843bff96e3e1f55ef92f
Balance response example
Response
{
"merchant_id": 138,
"balance": [
{
"currency": "BDT",
"amount": 1580
},
{
"currency": "PKR",
"amount": 934.99
}
],
"result_code": "OK",
"result_message": "request processed"
}
Example
138test
String to sign
`transactionId` → `operationId`
SHA-512
ab046ad1cf123383c626fb3f748135ca836d06b7c547698e48e81ee3a54ecc82f118edcb230b20f39c039a70b298be74115956207297bf696965d73017704be7