Skip to main content
Version: Lastest

Process payment result

After the customer completes the payment process, the AppotaPay system notifies the result to the partner's system through 2 forms

note
  • It is necessary to thoroughly check the parameters status, orderAmount, and signature to ensure they are valid before confirming the transaction as successful
  • It is recommended to call the api to check the transaction status to ensure the most accurate updated results
  • Use the 'signature' parameter to verify the integrity of the received data. The partner generates a signature from the data received from AppotaPay, then compares it with the 'signature' parameter sent by AppotaPay
  • IPN is only returned when the transaction is successful

Redirect URL

  • Customers will be directed to the partner's URL passed through the API via the 'redirectUrl' parameter.
  • On this page, the partner checks the data, transaction status, and displays notifications to the customer.

The parameters (query string) sent along with the URL

Method: GET

ParamsData typeDescription
dataStringThe transaction information is in base64encode & json_encode format.
signatureStringSignature to verify data integrity

signature = HMAC_SHA256(data, secretKey)

timeStringResponse time

Example result

data=eyJ0cmFuc2FjdGlvbiI6eyJlcnJvckNvZGUiOjAsIm1lc3NhZ2UiOiJUaFx1MDBlMG5oIGNcdTAwZjRuZyIsInBhcnRuZXJDb2RlIjoiVEVTVCIsImFwaUtleSI6Im9NaEpwa3o3SzZIRGNSNlMiLCJvcmRlckFtb3VudCI6NTAwMDAsImFtb3VudCI6NTAwMDAsImRpc2NvdW50QW1vdW50IjowLCJmZWVVc2VyIjowLCJzdGF0dXMiOiJzdWNjZXNzIiwiY3VycmVuY3kiOiJWTkQiLCJvcmRlcklkIjoiNWY1YjQ2Y2I3M2ZkMCIsImJhbmtDb2RlIjoiU0hCIiwicGF5bWVudE1ldGhvZCI6IkFUTSIsInBheW1lbnRUeXBlIjoiV0VCIiwiYXBwb3RhcGF5VHJhbnNJZCI6IkFQMjAwOTEwMDE0MTI1QiIsInRyYW5zYWN0aW9uVHMiOjE1OTk4MTc0MzMsImV4dHJhRGF0YSI6InRlc3QgdGVzdCJ9fQ== &signature=9487dd169d2178b249d1503d2f2d7f01d1210517f6ae3a2703760cb218c838f3&time=53485768945

IPN (Instant Payment Notification)

AppotaPay will send transaction notifications via the partner's API URL submitted to the API through the 'notifyUrl' parameter. The partner's server verifies the integrity of the data via the 'signature' parameter and then updates the status of the order

{
"Content-Type": "applicaton/json"
}

Response params

Method: POST

ParamsData typeDescription
dataStringThe transaction information is in base64encode & json_encode format
signatureStringSignature to verify data integrity

signature = HMAC_SHA256(data, secretKey)

timeStringResponse time

Decode data

In both IPN & URL, when notifying the Partner, the data format will be the same.

1.The partner uses the Base64Decode function to decode the data into a string. 2.Use the JSON_Decode function to decode the data for the second time into JSON forma

ParamsRequirementData typeDescription
transactionrequiredObjectTransaction information
transaction.transactionIdrequiredStringThe transaction code on AppotaPay's side
transaction.reconciliationIdoptionalStringThe settlement transaction code when the transaction is successful
transaction.partnerCoderequiredStringPartnercode
transaction.statusrequiredString[Transaction status](#Status code table)
transaction.errorCoderequiredIntegerError code table
transaction.errorMessagerequiredStringError description
transaction.orderAmountrequiredIntegerOrder amount
transaction.amountrequiredIntegerThe payment amount to the provider
transaction.discountAmountrequiredIntegerDiscount amount
transaction.currencyrequiredStringCurrency unit
transaction.bankCodeoptionalStringBankcode Selected by the customer
transaction.paymentMethodrequiredStringPayment method
transaction.actionrequiredStringType of payment
transaction.clientIpoptionalStringCustomer's payment IP
transaction.versionoptionalStringVersion API
transaction.feeoptionalObjectPayment fee
transaction.fee.customer_feeoptionalStringPayment fee charged to the custome
transaction.createdAtrequiredStringTransaction creation time. (in RFC-3339 standard format)
transaction.updatedAtrequiredStringTransaction update time. (in RFC-3339 standard format)
partnerReference.order.idrequiredStringPartner's order code
partnerReference.order.inforequiredStringOrder information
partnerReference.order.extraDatarequiredStringOptional additional information
tokenResultoptionalStringInformation token and card saved

Status code table

StatusDescription
pendingThe transaction is pending processing.
processingThe transaction is currently being processed.
successThe transaction is successful.
errorThe transaction has failed.

Token info

CodeDescription
statusCard status
messageError message
cardCard info
card.statusCard status
card.tokenToken information for next payment
card.card_numberCard number
card.card_nameCard holder
card.card_dateIssue/ Expiry date on card
card.card_typeCard type

Example Request:

{
"data": "eyJ0cmFuc2FjdGlvbiI6eyJ0cmF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 1726029178,
"signature": "171846e6962c5537c546ec5d6e6a864800db2366c330f418d7eff87661248a4c"
}

Response format

  • When confirming a successful transaction via IPN, the partner needs to respond to AppotaPay to confirm that they have received the result
  • In case the partner does not respond successfully, AppotaPay will attempt to respond up to 3 times, with a 5-minute interval between each attempt.
  • The response is considered successful when HTTP code = 200 and the status parameter in the response body = 'ok'.

Example success response

HTTP Code: 200

Body: {"status": "ok"}