POST /v1/invoice
Creates an invoice with a hosted payment page where buyers can select their preferred cryptocurrency and complete payment. Requires authentication.
Request
Section titled “Request”POST /v1/invoiceRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
price_amount | number | Yes | Invoice amount |
price_currency | string | Yes | Currency code |
pay_currency | string | No | Pre-select a payment currency |
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 |
partially_paid_url | string | No | Redirect if partially paid |
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”{ "id": "a1b2c3d4-e5f6-...", "token_id": "1", "order_id": "inv-100", "order_description": null, "price_amount": "50", "price_currency": "usd", "pay_currency": null, "ipn_callback_url": null, "customer_email": null, "partially_paid_url": null, "payout_currency": null, "is_fixed_rate": false, "is_fee_paid_by_user": false, "source": null, "collect_user_data": false, "created_at": "2025-01-15T10:30:00.000Z", "updated_at": "2025-01-15T10:30:00.000Z", "invoice_url": "https://api.nearpayments.io/invoice/a1b2c3d4-e5f6-...", "success_url": "https://example.com/success", "cancel_url": "https://example.com/cancel"}