Invoices
Invoices provide a hosted payment page where buyers can select their preferred cryptocurrency and complete payment.
Create Invoice
Section titled “Create Invoice”POST /v1/invoiceRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
price_amount | number | Yes | Invoice amount |
price_currency | string | Yes | Currency code |
order_id | string | No | Your internal order ID |
order_description | string | No | What’s being invoiced |
ipn_callback_url | string | No | Webhook URL |
success_url | string | No | Redirect after successful payment |
cancel_url | string | No | Redirect if cancelled |
Example
Section titled “Example”curl -X POST https://api.nearpayments.io/v1/invoice \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "price_amount": 50, "price_currency": "usd", "order_id": "inv-100", "success_url": "https://example.com/success", "cancel_url": "https://example.com/cancel" }'Response
Section titled “Response”The response includes an invoice_url — share this with your customer.
Get Invoice Payment
Section titled “Get Invoice Payment”GET /v1/invoice-payment?invoiceId={id}Returns the payment linked to an invoice, or a message if no payment has been created yet.