Skip to Content
Core ConceptsInvoice Lifecycle

Invoice Lifecycle

Every invoice moves through a series of statuses from creation to acceptance (or failure).

Status diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ draft │────>β”‚ queued │────>β”‚ pending │────>β”‚ accepted β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€β”€β”€β”€>β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ rejected β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ └────>β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” (retry, max 5) β”‚ failed │────> queued β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ accepted ────> cancelled (creates credit note)

Statuses

StatusDescriptionWhat you can do
draftCreated, not submittedEdit, delete, or submit
queuedIn the submission queueWait. Cannot modify.
pendingSent to tax authority, awaiting responsePoll with GET /invoices/:id/status or wait for webhook
acceptedTax authority accepted the invoiceDownload PDF. Can cancel (creates credit note).
rejectedTax authority rejected the invoiceRead error details. Create a corrected invoice.
failedSubmission failed (network, timeout)Retry with POST /invoices/:id/retry. Max 5 attempts.
cancelledInvoice voidedA credit note is created automatically.

What triggers each transition

FromToTrigger
β€”draftPOST /i/v1/invoices
draftqueuedPOST /i/v1/invoices/:id/submit
queuedpendingWorker picks up the job
pendingacceptedTax authority returns approval
pendingrejectedTax authority returns rejection with errors
pendingfailedNetwork error, timeout, or tax authority unavailable
failedqueuedPOST /i/v1/invoices/:id/retry
acceptedcancelledPOST /i/v1/invoices/:id/cancel

Webhook events by status

These are the events actively dispatched to your webhook endpoints:

Status changeWebhook event
β†’ acceptedinvoice.approved
β†’ rejectedinvoice.rejected
β†’ failed (submission error)invoice.failed

Handling rejections

Rejected invoices cannot be resubmitted. You must create a new invoice with the corrections:

Retrieve the rejected invoice to inspect error details:

bash
curl https://gateway.useyona.com/i/v1/invoices/inv_rejected_id \
  -H "Authorization: Bearer sk_test_your_key_here"

Create a corrected invoice with a new invoice number:

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "sellerId": "c7a1d3e5-8f2b-4a6c-9d0e-1f2a3b4c5d6e",
    "buyerId": "d8b2e4f6-9a3c-5b7d-0e1f-2a3b4c5d6e7f",
    "invoiceNumber": "INV-2026-001-R1",
    "invoiceDate": "2026-04-20",
    "lineItems": [{ "description": "Corrected line item", "quantity": 10, "unitPrice": 50000, "taxPercent": 7.5, "hsnCode": "9983", "unitCode": "HUR" }]
  }'

Submit the corrected invoice:

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/{corrected_id}/submit \
  -H "Authorization: Bearer sk_test_your_key_here"

Handling failures

Failed invoices can be retried up to 5 times:

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/inv_failed_id/retry \
  -H "Authorization: Bearer sk_test_your_key_here"

After 5 failures, the invoice.failed webhook fires. Investigate the error before creating a new invoice.

πŸ’‘ SDK available

See SDK β€” Invoices for the programmatic interface.

Last updated on