# Create an invoice

`POST https://morzepay.com/v1/invoices`

POST`/v1/invoices`

Creates an invoice. By default it’s a draft: finalize it to give it a number and a payment link, or send it straight away with `send: true`. Your customer pays on the hosted page with MTN Mobile Money or Airtel Money and gets a receipt.

Permission`invoices:write`

### Headers

`Idempotency-Key`stringheader

8–80 letters, digits, `-` or `_`. Lets you retry safely: the same key and body return the first answer and never move money twice. See [Idempotency](https://morzepay.com/docs/api#idempotency).

### Body

JSON, with `Content-Type: application/json`.

`customer`objectrequired

Who you are billing.

Show child attributes

`name`stringrequired

The customer’s name.

`email`string

Needed to email the invoice and the receipt.

`phone`string

Needed to text the invoice. It also fills in the payment page.

`address`string

Printed on the invoice.

`items`arrayrequired

Up to 50 lines.

Show child attributes

`description`stringrequired

What the line is for.

`quantity`integerrequired

How many.

`unit_amount`integerrequired

The price of one, in whole UGX.

`tax_percent`number

Tax on the subtotal, such as `18` for VAT. Rounded to the nearest shilling.

`due_date`string

A date such as `2026-11-30`. Or use `days_until_due`.

`days_until_due`integer

Days from today. Defaults to your invoice settings (14 days unless you changed it).

`wallet_id`string

Where payments land. Defaults to your main wallet.

`fee_bearer`string

`wallet` or `customer`. With `customer`, the collection fee is added on the payment page and the wallet receives the full total.

`memo`string

A note on the invoice, up to 1,000 characters.

`footer`string

Small print at the bottom, up to 500 characters.

`reference`string

Your own unique id for the invoice, up to 64 characters.

`metadata`object

Up to 20 keys of your own, with simple values. Returned on the object and in webhooks.

`finalize`boolean

`true` gives it a number and payment link now.

`send`boolean

`true` finalizes it and sends it.

`send_via`arraydefault: ["email"]

`["email"]`, `["sms"]` or both.

### Returns

The invoice. Once finalized, `hosted_invoice_url` is the payment link: share it anywhere. `invoice_pdf` downloads the PDF without a key. With `send`, `delivery` says what was sent.

### Errors

| Status | Code | When |
| 422 | INVALID_TOTAL | The total must be between UGX 500 and UGX 5,000,000 to be paid with mobile money. |
| 422 | NO_CUSTOMER_EMAIL | You asked to email it, but there’s no customer.email. |
| 422 | NO_CUSTOMER_PHONE | You asked to text it, but there’s no customer.phone. |
| 409 | DUPLICATE_REFERENCE | Another invoice already has this reference. |

The common codes, such as `UNAUTHENTICATED` and `RATE_LIMITED`, can come from any endpoint. See [Errors](https://morzepay.com/docs/api#errors).



## Example request

```bash
curl -X POST "https://morzepay.com/v1/invoices" \
  -H "Authorization: Bearer $MORZEPAY_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: inv-order-1001" \
  -d '{
  "customer": {
    "name": "Sarah Namuli",
    "email": "sarah@example.com",
    "phone": "0772418905"
  },
  "items": [
    {
      "description": "Website design (5 pages)",
      "quantity": 1,
      "unit_amount": 450000
    },
    {
      "description": "Hosting, 12 months",
      "quantity": 2,
      "unit_amount": 75000
    }
  ],
  "tax_percent": 18,
  "days_until_due": 14,
  "reference": "order-1001",
  "send": true
}'
```

## Example response (201)

```json
{
  "success": true,
  "data": {
    "id": "inv_UfwyBh1W4Jfa6iG2u2AVT3",
    "object": "invoice",
    "livemode": true,
    "number": "NILE-0001",
    "status": "open",
    "past_due": false,
    "wallet_id": "wal_8fK2mQx7RtP4nVb9LcHs2w",
    "currency": "UGX",
    "customer": {
      "name": "Sarah Namuli",
      "email": "sarah@example.com",
      "phone": "+256772418905",
      "address": null
    },
    "lines": [
      {
        "description": "Website design (5 pages)",
        "quantity": 1,
        "unit_amount": "450000.00",
        "amount": "450000.00"
      },
      {
        "description": "Hosting, 12 months",
        "quantity": 2,
        "unit_amount": "75000.00",
        "amount": "150000.00"
      }
    ],
    "subtotal": "600000.00",
    "tax_percent": 18,
    "tax": "108000.00",
    "total": "708000.00",
    "amount_paid": "0.00",
    "amount_due": "708000.00",
    "fee_bearer": "wallet",
    "due_date": "2026-10-18",
    "memo": null,
    "footer": null,
    "reference": "order-1001",
    "metadata": null,
    "hosted_invoice_url": "https://morzepay.com/i/3f31d270b9829c826d28f0a4e68d7715",
    "invoice_pdf": "https://morzepay.com/i/3f31d270b9829c826d28f0a4e68d7715/pdf",
    "receipt_id": null,
    "receipt_url": null,
    "transaction_id": null,
    "paid_out_of_band": false,
    "created_at": "2026-10-04T10:00:12+03:00",
    "finalized_at": "2026-10-04T10:00:12+03:00",
    "sent_at": "2026-10-04T10:00:13+03:00",
    "paid_at": null,
    "voided_at": null,
    "delivery": {
      "email": true,
      "sms": null
    }
  }
}
```
