POST /payment/invoice
Creates an invoice with a hosted payment page where buyers can complete payment. Requires authentication.
Request
Section titled “Request”POST /payment/invoiceRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Invoice amount |
currency | string | Yes | Fiat or crypto currency code |
lifetime | number | No | Invoice lifetime in minutes |
fee_paid_by_payer | 0 | 1 | No | Whether the payer covers network fees |
under_paid_coverage | number | No | Percentage tolerance for underpayment |
to_currency | string | No | Auto-convert received funds to this currency |
callback_url | string | No | Webhook URL for payment updates |
return_url | string | No | Redirect URL after payment |
email | string | No | Customer email |
order_id | string | No | Your internal order ID |
thanks_message | string | No | Message shown after payment |
description | string | No | Invoice description |
Example
Section titled “Example”curl -X POST https://api.nearpayments.io/oxapay/v1/payment/invoice \ -H "merchant_api_key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 50, "currency": "USD", "order_id": "inv-100", "return_url": "https://example.com/thanks" }'Response
Section titled “Response”{ "data": { "track_id": "abc123", "payment_url": "https://api.nearpayments.io/pay/abc123", "expired_at": 1700000000, "date": 1699996400 }, "message": "Operation completed successfully!", "error": {}, "status": 200, "version": "1.0.0"}