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.

post
Header parameters
merchant_api_keystringRequired

Your Merchant API Key for authentication and authorization.

Content-TypestringRequiredDefault: application/json
Body
amountnumber · decimalRequired

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.

currencystringOptional

Specify the currency symbol if you want the invoice amount calculated with a specific currency. You can also generate invoices in fiat currencies.

lifetimeinteger · min: 15 · max: 2880Optional

Set the expiration time for the payment link in minutes.

Default: 60
fee_paid_by_payernumber · decimal · max: 1Optional

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.

Default: Merchant settingExample: 1
under_paid_coveragenumber · decimal · max: 60Optional

Specify the acceptable inaccuracy in payment. Determines the maximum acceptable difference between the requested and paid amount.

Default: Merchant settingExample: 10
to_currencystringOptional

The currency symbol of the cryptocurrency you want to convert to. You only can convert paid crypto currencies to USDT.

auto_withdrawalbooleanOptional

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.

mixed_paymentbooleanOptional

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.

Default: Merchant settingExample: true
callback_urlstringOptional

The URL where payment information will be sent. Use this to receive notifications about the payment status.

return_urlstringOptional

The URL where the payer will be redirected after a successful payment.

emailstringOptional

Provide the payer's email address for reporting purposes.

order_idstringOptional

Specify a unique order ID for reference in your system.

thanks_messagestringOptional

A thanks message that brief note displayed to the payer after a successful payment.

descriptionstringOptional

Provide order details or any additional information that will be shown in different reports.

sandboxbooleanOptional

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.

Responses
200

Successful operation

application/json
post
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