1.Merchant call Create Invoice API method to create an invoice in the UniPayment system.
2.UniPayment checks if the invoice is valid.
2a. If the invoice is valid, UniPayment responds with code "OK" and order data. After receiving response, merchant should redirect the shopper to checkout_url address or prepay the checkout page using data in response.
2b. If the invoice is not valid, UniPayment returns error code and an error message.
3.When the buyer make the payment, UniPayment sends Payment Notification to notify_url using POST method, which is specified when creating the invoice (see Create Invoice). UniPayment also sends Notification when order status is changed to paid, expired or to any other status (see Invoice Statuses).
API Request
curl --request GET \
--url https://unipayment.io/api/invoice/create \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"app_id": "94273135-a935-4753-937b-c293987d44c8",
"price_amount": 10,
"price_currency": "USD",
"pay_currency": "USDT",
"notify_url": "https://example.com/pay/callback",
"redirect_url": "http://example.com/pay/result",
"order_id": "ORDER_123456"
"sign": "XXXXXXXXXX"
}
'
API Response
Example
{
"msg": "",
"code": "OK",
"data": {
"pair": "BTC_USD",
"rate": 38359.98
}
}
Descriptioin
Name | Type | Description |
---|---|---|
msg | string | Response message |
code | string | If request is processed success then code is "OK", if failed code is the error code. |
data | Object | Response data |
{
"msg": "",
"code": "OK",
"data": {
"invoice_idd": "628b8927-9538-49d6-bc39-cf50bfbdc3a5",
"price_amount": "1",
"price_currency": "USD",
"network": "NETWORK_TRX",
"address": "TFmHeEqTrUQ4mFRewsc9YwYzgeLaA3oqAy",
"pay_amount": "1",
"pay_currency": "USDT",
"expiration_time": "0001-01-01T00:00:00",
"checkout_url": "htppts://unipayment.io/i/628b8927-9538-49d6-bc39-cf50bfbdc3a5",
"qr_code_rrl": "qrurl",
"sign": "8fc894e8fd088df410447d546fd1732d"
}
}