Payment Callback
When creating a payment, you can pass a callbackUrl
parameter to the MixPay API.
Please checkout the Security Guidelines first.
When creating a payment, you can pass a callbackUrl
parameter to the API.
callbackUrl
only supports HTTPS and has to be URL encoded.
Callback only happens when MixPay successfully received the customer's payment.
Receiving result
After payment successfully, MixPay will issue a POST request to this URL, with the following JSON content as an example:
{
"orderId": "xxxxxxxxxxxx",
"traceId": "xxxxxxxxxxxx",
"payeeId": "xxxxxxxxxxxx"
}
For security reasons, we're not passing the payment result on purpose. You can follow the instruction below for getting the payment result.
When your callback endpoint receives a call, you MUST do the following checks:
- First, in your database, look for the incoming
orderId
ortraceId
value. This step is essential, be careful anyone can post a fake value to your endpoint; - Call the payments-results API, and check for
data.status
field to besuccess
; - Check the
data.payeeId
is yours; - Check the
data.quoteAmount
anddata.quoteAssetId
are both match your order;
Caution: Only all of the conditions we mentioned above are passed, then you can mark your order as completed.
Response to the callback
Your endpoint should return an HTTP status 200 with the following JSON data:
{
"code": "SUCCESS"
}
Anything code
not equal to SUCCESS
, MixPay server will see it as a failure, then our server will retry at 0s/15s/15s/30s/180s/1800s/1800s/1800s/1800s/3600s, a total 10 times。
You can use postbin to test it out.