> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pavewaygroup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an Invoice

> Create and dispatch an invoice to collect payment from a customer.

Creates a new invoice for a customer. Once finalized, an invoice generates a hosted payment URL (`hosted_invoice_url`) where the customer can select their preferred payment method.

***

### Request Body

**customer\_id** `string` *required*

The ID of the customer who will be billed (`cus_...`).

**amount** `integer | string` *required*

The total amount due on the invoice.

**currency** `string` *required*

Three-letter ISO currency code (`XAF`, `XOF`, `GHS`, `KES`, `USD`, `EUR`).

**description** `string`

An arbitrary description or summary of items included on this invoice.

**due\_date** `string`

The date on which payment for this invoice is due (ISO 8601 format, e.g. `2026-11-20`).

**auto\_advance** `boolean` (default: true)

Controls whether Pursar will automatically finalize and send the invoice.

***

### Code Examples

```bash cURL theme={null}
curl -X POST https://api.viarosandbox.com/v1/invoices \
  -u sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG: \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "cus_9f1a2b3c4d5e",
    "amount": 75000,
    "currency": "XAF",
    "description": "Enterprise consulting retainer - November 2026",
    "due_date": "2026-11-20"
  }'
```

```python Python theme={null}
import requests

url = "https://api.viarosandbox.com/v1/invoices"
auth = ("sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG", "")

payload = {
    "customer_id": "cus_9f1a2b3c4d5e",
    "amount": 75000,
    "currency": "XAF",
    "description": "Enterprise consulting retainer - November 2026",
    "due_date": "2026-11-20"
}

response = requests.post(url, auth=auth, json=payload)
print(response.json())
```

```javascript Node.js theme={null}
const axios = require('axios');

async function createInvoice() {
  const response = await axios.post(
    'https://api.viarosandbox.com/v1/invoices',
    {
      customer_id: 'cus_9f1a2b3c4d5e',
      amount: 75000,
      currency: 'XAF',
      description: 'Enterprise consulting retainer - November 2026',
      due_date: '2026-11-20'
    },
    {
      auth: {
        username: 'sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG',
        password: ''
      }
    }
  );

  console.log(response.data);
}

createInvoice();
```

***

### Response

```json theme={null}
{
  "id": "in_1a2b3c4d5e6f",
  "object": "invoice",
  "customer": "cus_9f1a2b3c4d5e",
  "customer_name": "Jane Doe",
  "customer_email": "jane.doe@example.com",
  "amount_due": 75000,
  "amount_paid": 0,
  "currency": "XAF",
  "status": "open",
  "description": "Enterprise consulting retainer - November 2026",
  "due_date": "2026-11-20T00:00:00Z",
  "hosted_invoice_url": "https://invoice.viarosandbox.com/i/in_1a2b3c4d5e6f",
  "invoice_pdf": "https://invoice.viarosandbox.com/pdf/in_1a2b3c4d5e6f.pdf",
  "created_at": "2026-11-06T12:00:00Z"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.