## How it works

Invoices and credit notes are accounting documents tied to shop sales. Creating or finalizing a document does not itself move money.

## Implementation

Select the shop, buyer, lines, currency and tax treatment. A draft can be edited; an issued document needs a credit note or supported voiding procedure rather than silent changes. Use line credits for partial corrections and retain document IDs with the order. merchant_invoice_finalized and merchant_invoice_voided report document transitions. Configure seller and tax details in invoice settings before issuing documents.

## Draft, issued, voided

| Status | Allowed |
| --- | --- |
| `draft` | Edit buyer, notes, due date, line descriptions, tax treatment (`PATCH /invoices/{invoice_id}`); delete. No number yet. |
| `issued` | PDF (`GET /invoices/{invoice_id}/pdf`), buyer link (`POST /invoices/{invoice_id}/share-link`), void, credit. |
| `voided` | Withdrawn; keeps its number. |

## Related guides

- [Invoices](/docs/dashboard/invoices/)
- [API reference](/docs/payment-api/reference/)
- [Webhook events](/docs/payment-api/webhooks/)

## Request examples

```bash
curl -X POST https://api.spicepay.net/invoices \
  -H 'api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: invoice_pay_xxxxx' \
  -d '{
    "source": { "payment_id": "pay_xxxxx" },
    "finalize": true
  }'
```

```bash
curl -X POST https://api.spicepay.net/invoices/inv_xxxxx/credit-note \
  -H 'api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"reason": "Refund of one bag", "finalize": true}'
```
