Skip to main content

Handling additional purchase data for Host-to-Host integration

Amanpay may sometimes request that you send it some data necessary for a purchase to be performed. It may happen:

  • when your request doesn't include some of required parameters
  • when the payment system sends your customer a one-time password (OTP) or confirmation code that you should then provide Amanpay with
  • when we send you QR data for displaying the QR code

When Amanpay needs you to provide it with some data, it sends you a callback indicating what data it needs to perform the purchase.

The following table contains the possible callback parameters:

ParameterTypeRequiredDescription
transactionIdintegerRequiredPayment ID within the Amanpay payment platform.
operationIdintegerOptionalOperation ID within the Amanpay payment platform. Required for SPECIFICATION status
additionalFieldsobjectOptionalThe object where the data the payment platform needs are submitted.
additionalDataobjectOptionalContains additional payment-related parameters required by the payment platform. (QR data for example)
statusobjectRequiredPurchase status. Possible values: PENDING — additional data is required to continue the purchase flow; SPECIFICATION — Amanpay requests extra information or customer interaction (for example, OTP confirmation or QR code display)

Here is an example of the data from such a callback:

  • with Otp request
{
"additional_fields": [ // The array where the data Amanpay needs to perform the purchase is indicated
"Otp"
],
"operationId": 29609,
"transactionId": 62861,
"status": "SPECIFICATION"
}
  • with QR code
{
"additional_data": {
"QrData": "00020101021228760032452a630c86b843a18ff4731f857131e90108BKIPPKKA0224PK69BKIP999990348338499652045818530358654031005802PK5909ASSAN PAY6007Karachi64300002EN0109ASSAN PAY0207Karachi62500214+92-34833849960520312241202605211730120804PURP84760032452a630c86b843a18ff4731f857131e90136452a630c-86b8-43a1-8ff4-731f857131e963049E30"
},
"operationId": 653725,
"transactionId": 102073,
"status": "PENDING"
}
  • with p2p payment data
{
"additional_data": {
"PaymentData": "0222222222"
},
"additional_fields": [
"TrxId"
],
"operationId": 102383,
"transactionId": 102540,
"status": "SPECIFICATION"
}

Upon receiving such a callback, you should provide Amanpay with the data it needs by sending it a request as follows:

The callback with the PENDING status does not require any additional information from the merchant.

URLhttps://gateway.amanpay.io
API endpoint/payments/purchases/specify/{operationId}
HTTP request methodPOST
Request body formatJSON
HeaderValueDescription
Content-Typeapplication/jsonHTTP header indicating the media type of the resource sent in the request body.
AuthorizationcalculatedSignature string. For the information on how to generate the signature, see Signature generation and verification.

The following table contains the parameters that have to be used in requests to provide Amanpay with the data it needs for the purchase to be performed.

ParameterTypeRequiredDescription
transactionIdintegerRequiredPayment ID within the Amanpay payment platform.
merchantIdintegerRequiredYour unique merchant ID that you got from Amanpay when integrating.
additionalFieldsobjectOptionalThe object where the data the payment platform needs are submitted.


Here is an example of a request where the necessary data are submitted to the Amanpay payment platform.

curl -X POST "https://gateway.amanpay.io/payments/purchases/specify/29609" \
-H "Content-Type: application/json" \
-H "Authorization: b78d07bc3e51899182339bfb39c85ab8629085c80f9b2312444669a3bdd78cc0522a1bcca50ede6be3a90fcf489100304cde09e14fa51a175a5fed0e36f6c26b" \
-d '{
"transactionId": 62861,
"merchantId": 1758378,
"additionalFields": {
"Otp": "385927471757185"
}
}'