Quickstart
This quickstart takes an existing product ID and requests an invoice for a customer. The request and response are shown beside the guide.
Before you begin
Get your API token from the Xara developer dashboard. You will also need the ID of a product that belongs to the authenticated business.
If you do not have a product yet, create one first.
1. Build the invoice items
Every invoice needs at least one product_id and its quantity.
Send items as a normal JSON array:
"items": [{ "product_id": 128, "quantity": 1 }]
Each product_id must belong to the business associated with your API token.
2. Request the invoice
Send customerPhoneNumber and items to Payment/initiateInvoice. Include your API token in the Authorization header using the Bearer scheme.
The example on the right can be switched between cURL and JavaScript.
3. Store the reference
Keep the returned reference with your order:
INV-…
You will use it to match the payment webhook to the correct customer or order.
4. Handle payment
Register a webhook URL in your business dashboard, then follow the payment webhook guide to verify the request and record the payment.