Payment Callback
After a payment request is made and the user navigates to the Paymento gateway to complete the payment, the user is redirected back to the merchant's Return URL (Given in Payment Request) with a specific status. This allows the merchant to update the order status in their interface. However, it is crucial for merchants to use the Set Payment Settings API to define the IPN URL for receiving payment statuses and to verify the payment using the Verify Payment API.
Redirect and Callback Data
Paymento returns the following variables in the Callback (to Return URL and IPN URL):
HTTP Headers
X-HMAC-SHA256-SIGNATURE
“Signature hash…”
Body Patameters
Token
Token of the payment order.
PaymentId
The order ID in Paymento (Payment ID, as a long number).
OrderId
The order ID from the online store (as a string).
OrderStatus
The order status (explained in next paragraph)
AdditionalData
The payment request's additional data.
Order Statuses
When the user completes or cancels the payment, Paymento redirects them to the specified callback URL with one of the following statuses:
Initialize (0): Payment request accepted by the API.
Pending (1): User has chosen a coin to pay.
PartialPaid (2): User paid less than the order amount.
WaitingToConfirm (3): User's transaction received in the blockchain network (in mempool or block).
Timeout (4): Payment deadline expired.
UserCanceled (5): User clicked on the cancel button at the gateway.
Paid (7): User's transaction confirmed in the blockchain network.
Approve (8): Payment verified by the store.
Reject (9): Address assigned for the user's payment is no longer monitored, or payment not verified by the store.
HMAC Signature Verification
To ensure the integrity and authenticity of callbacks from Paymento, we use HMAC-SHA256 signatures. For each callback, Paymento includes a signature in the X-Hmac-Sha256-Signature
header. To verify this signature:
Obtain the raw payload of the callback (the entire body of the POST request).
Use your secret key (Provided in your Paymento dashboard).
Calculate the HMAC-SHA256 hash of the payload using your secret key.
Convert the resulting hash to uppercase hexadecimal format.
Compare this calculated signature with the one received in the
X-Hmac-Sha256-Signature
header.
Important notes
Do Not Rely Solely on Redirect to Return URL: Merchants must use the IPN URL set in the "Set Payment Settings API" to receive real-time payment status updates.
Always Verify Payments: Even after receiving a "Paid" status, always verify the payment using the Verify Payment API to ensure the transaction is confirmed on the blockchain and status update came from Paymento.
Call Back Example
Last updated