Generate Invoice
This endpoint enables you to generate a new invoice and obtain a payment URL for completing the transaction. By providing the required parameters in your request, you can specify the invoice amount and customize various options for the payment process.
Your Merchant API Key for authentication and authorization.
application/json
The amount for the payment. If the currency field is not filled, the amount should be specified in dollars. If the currency
field is filled, the amount should correspond to the specified currency.
Specify the currency symbol if you want the invoice amount calculated with a specific currency. You can also generate invoices in fiat currencies.
Set the expiration time for the payment link in minutes.
60
Specify whether the payer will cover the invoice commission. 1 indicates that the payer will pay the fee, while 0 indicates that the merchant will pay the fee.
Merchant setting
Example: 1
Specify the acceptable inaccuracy in payment. Determines the maximum acceptable difference between the requested and paid amount.
Merchant setting
Example: 10
The currency symbol of the cryptocurrency you want to convert to. You only can convert paid crypto currencies to USDT.
1 indicates that the received currency will be sent to the address specified in your Address List on the Settings page and 0 indicates that the amount will be credited to your OxaPay balance.
Specify whether the payer can cover the remaining amount with another currency if they pay less than the invoice amount. 1 allows the user to pay the remainder with a different coin, while 0 doesn't allow it.
Merchant setting
Example: true
The URL where payment information will be sent. Use this to receive notifications about the payment status.
The URL where the payer will be redirected after a successful payment.
Provide the payer's email address for reporting purposes.
Specify a unique order ID for reference in your system.
A thanks message that brief note displayed to the payer after a successful payment.
Provide order details or any additional information that will be shown in different reports.
The sandbox field is a boolean that specifies whether the API request should operate in sandbox mode (test environment). Set it to true for testing and false for live transactions.
Successful operation
Bad request
import requests
import json
url = 'https://api.oxapay.com/v1/payment/invoice'
headers = {
'merchant_api_key': 'YOUR_MERCHANT_API_KEY',
'Content-Type': 'application/json'
}
data = {
"amount": 100,
"currency": "USD",
"lifetime": 30,
"fee_paid_by_payer": 1,
"under_paid_coverage": 2.5,
"to_currency": "USDT",
"auto_withdrawal": False,
"mixed_payment": True,
"callback_url": "https://example.com/callback",
"return_url": "https://example.com/success",
"email": "[email protected]",
"order_id": "ORD-12345",
"thanks_message": "Thanks message",
"description": "Order #12345",
"sandbox": False
}
response = requests.post(url, data=json.dumps(data), headers=headers)
result = response.json()
print(result)
{
"data": {
"track_id": "184747701",
"payment_url": "http://pay.oxapay.com/12373985/184747701",
"expired_at": 1734546589,
"date": 1734510589
},
"message": "Operation completed successfully!",
"error": {},
"status": 200,
"version": "1.0.0"
}
Last updated