The process for creating an invoice in the UniPayment system involves several steps:

1.The merchant calls the Create invoice API method to create the invoice.

2.Gateway validates the invoice.

  • 2a. If the invoice is valid, gateway responds with a "OK" code and the order data.
    The merchant should then redirect the buyer to the url invoice_url or prepay the checkout page using the data in the response.
  • 2b. If the invoice is invalid, gateway returns an error code and an error message.

When the buyer makes a payment, gateway sends a Instant Payment Notification to the notify_url via the POST method, which was specified during the invoice creation process (refer to Create invoice). gateway also sends notifications when the order status changes to paid, expired, or any other status (refer to Invoice Status).

API Request

curl --request GET \
     --url https://unipayment.io/api/invoice/create \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '
{
	"app_id": "de5076a5-71aa-4a4a-a35f-bdb424af5658",
	"order_id": "5f166a9592e54babad01c26b243b69be",
	"title": "Test Invoice",
	"description": "Test Desc",
	"price_amount": 100,
	"price_currency": "USD",
	"pay_currency": "USDT",
	"notify_url": "https://example.com/notify",
	"redirect_url": "https://example.com/redirect",
	"lang": "en-US"
}
'

API Response

Example

{
	"code": "OK",
	"msg": "",
	"data": {
		"address": None,
		"app_id": "de5076a5-71aa-4a4a-a35f-bdb424af5658",
		"confirm_speed": "Medium",
		"create_time": "2023-05-05T03:35:19",
		"error_status": "None",
		"exchange_rate": 0.0,
		"expiration_time": "2023-05-05T03:55:19",
		"invoice_id": "KrRnGKYgy8vXvqXtscG4AT",
		"invoice_url": "https://app.unipayment.io/i/KrRnGKYgy8vXvqXtscG4AT",
		"network": None,
		"order_id": "5f166a9592e54babad01c26b243b69be",
		"paid_amount": 0.0,
		"pay_amount": 0.0,
		"pay_currency": "USDT",
		"price_amount": 100.0,
		"price_currency": "USD",
		"status": "New"
	}
}

Descriptioin

NameTypeDescription
msgstringResponse message
codestringIf request is processed success then code is "OK", if failed code is the error code.
dataObjectResponse data