Create an Invoice
Create an invoice by sending an HTTP POST message to BasicEx Payment and passing the ticket details in the request body.
Submission URL: https://openapi.basicex.com/v2/invoices
Request Method: POST
Content-Type:
application/json
Upon successful creation, the detailed invoice information will be provided in the JSON-encoded response.
In case of an error, you will receive a JSON-encoded error response. All error responses will have an "error" field, which is an object with two fields (referred to as type and message). Refer to Error Codes for more details.
Required POST Fields
orderId
Merchant's internal order number, unique within the same merchant, used to associate the payment invoice with the merchant's order ID.
amount
Amount field in integer format. That is, if a user pays 2.00
, the value to be passed is 200
.
This field will determine whether the amount passed is in fiat or cryptocurrency based on the amountType
field.
precision
Amount precision, combined with amountType
. When passing coin_amount
(cryptocurrency), a precision of 2-6 digits is recommended; for money_price
(fiat), the precision is 2.
amountType
Amount type field, indicating whether the amount
passed is in fiat or cryptocurrency.
coin_amount
for cryptocurrency amount, money_price
for fiat amount.
description
Product description field, will be displayed on the checkout page for item details.
notificationUrl
URL for notifying the merchant at a specified address with Webhook notifications. Must be HTTPS
.
Optional Fields
buyerId
Merchant's customer identification number for the client paying this invoice.
fiat
ISO 4217 3-character code for fiat currency, displayed in the checkout or other locations for the price; or for converting the corresponding currency amount.
currency
Cryptocurrency currency, e.g., USDT, BTC, etc. View Currency List. When this parameter is passed, the invoice can only be paid in this currency.
forcedChain
Force selection of a specific blockchain, e.g., TRC20, ERC20, etc. View Blockchain List. When this parameter is passed, users can only pay on the specified blockchain and cannot use the BasicEx Wallet for payment.
metadata
Structured metadata passed in for the merchant's own record of corresponding data. This field will be returned as-is in subsequent responses.
payerEmail
Merchant's customer email. If provided, an email will be sent to this address after the invoice is successfully paid.
redirectUrl
URL to redirect to after successful payment on the checkout page. This URL must start with https
or http
.
buyerIp
Merchant's client IP address.
sendPaidNotification
Whether to send notification data for the paid state.
Default is false
. If set to true
, BasicEx will send a paid
status notification after receiving the user's transferred funds on the blockchain and after one block confirmation. Due to the nature of blockchain, this does not mean the order is entirely valid. BasicEx will send a complete
status notification after confirming the transaction is successful and irreversible.
physical
Whether it is a physical product, default is false
. If it is a physical product, set to true
.
BasicEx Payment Server Response
The response to create an invoice request and the response to get an invoice request have the same JSON representation of the invoice object.
Refer to the REST API Reference for a complete resource description and more information.