# Invoice status flow

The status of invoices varies depending on the timing and the amount of cryptocurrency sent by the end user to the invoice's receiving address.

When updating payment status on your side, you will want to look for  the `status,` `statusContext` and `paymentStatus` attribute values when polling the [Read Invoice](https://docs.txn.io/invoices/reading-invoice) endpoint that returns invoice details by its ID.

* The `status` attribute value represents the current status of the invoice, indicating whether Txn is currently waiting for payment, is busy processing payment, or if the invoice has expired
* The `paymentStatus` attribute value provides information on whether the payment was made on time within 20 minutes or if the payment is late, meaning the cryptocurrency was received after the invoice expired
* The `statusContext` attribute value provides information on whether the end-user made their payment in full, underpaid, or overpaid the invoice

You will find possible attribute value combinations in the table below.

<table><thead><tr><th width="142">status</th><th>statusContext</th><th>paymentStatus</th><th width="123">Final state?</th><th>Description</th></tr></thead><tbody><tr><td>pending</td><td>unpaid</td><td>expecting</td><td>no</td><td>Invoice created, awaiting transaction.</td></tr><tr><td>expired</td><td>unpaid</td><td>expecting</td><td>no</td><td>No payment was received within 20 minutes.</td></tr><tr><td>processing</td><td>unpaid</td><td><ul><li>onTime</li><li>late</li></ul></td><td>no</td><td>Payment detected, awaiting confirmations.</td></tr><tr><td>completed</td><td><ul><li>full</li><li>underpaid</li><li>overpaid</li></ul></td><td><ul><li>onTime</li><li>late</li></ul></td><td>yes</td><td>Invoice completed, funds credited to the merchant's account on Txn.</td></tr><tr><td>on_hold</td><td>unpaid</td><td>expecting</td><td>no</td><td>Txn isn’t comfortable with the payment risk level. The payment is subject to further review by Txn compliance.</td></tr><tr><td>cancelled</td><td>unpaid</td><td><ul><li>expecting</li><li>onTime</li><li>late</li></ul></td><td>yes</td><td>No payment was received within 7 days (168hrs)</td></tr><tr><td>rejected</td><td>unpaid</td><td>expecting</td><td>yes</td><td>Invoice was rejected due to risk payment rejected by Txn Compliance</td></tr></tbody></table>

For better context, below is the generalized invoice process flow that visualizes the flow of invoice statuses.

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2FbnOtw1LR2SGSVkrnr469%2Fimage.png?alt=media&#x26;token=f26be780-b905-401a-b88d-36abb3a18a39" alt=""><figcaption></figcaption></figure>

For more convenience, we've split the above process flow into separate payment flows that you will want to handle on your side.

### Happy Flow

* The end-user sends the **exact amount of crypto** they have been asked to send
* The end-user sends their crypto **within 20 minutes**
* The merchant receives the invoice amount minus processing fees in their account

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2FUXkjKJLrg3x2KUWs22cd%2Fimage.png?alt=media&#x26;token=c05f7fe9-5bc2-499a-95fd-d6f7356739e5" alt=""><figcaption></figcaption></figure>

### Underpaid Flow

* The end-user sends **less crypto** than they have been asked to send
* The end-user sends their crypto **within 20 minutes**
* Txn applies the **spot exchange rate** to the received amount of crypto
* The merchant receives the result of the currency conversion

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2FkT2YIH1VvPeIjHNEdJig%2Fimage.png?alt=media&#x26;token=991d7936-c40a-479e-92fe-31d27f8ffe08" alt=""><figcaption></figcaption></figure>

### Overpaid Flow

* The end-user sends **more crypto** than they have been asked to send
* The end-user sends their crypto **within 20 minutes**
* Txn applies the **spot exchange rate** to the received amount of crypto
* The merchant receives the result of the currency conversion

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2FsOFamS36DQx1VZOGoO3X%2Fimage.png?alt=media&#x26;token=c4fea9d8-fbd3-4ef2-a498-1b7cc5f38421" alt=""><figcaption></figcaption></figure>

### Late Payment Flow

* The end-user sends either the **exact amount of crypto, less crypto, or more crypto** than they have been asked to send
* The end-user sends their crypto **within 20 minutes**
* Txn applies the **spot exchange rate** to the received amount of crypto
* The merchant receives the result of the currency conversion

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2Fst3jFSaJsIvprkVvBbXH%2Fimage.png?alt=media&#x26;token=ea845c8f-e10d-482e-b0f4-d6a7a6f4a568" alt=""><figcaption></figcaption></figure>

### Risk Payment Flow

* The cryptocurrency **payment comes from a source that is connected to illegal activities**, e.g., dark markets, drug markets, sanctioned entities, etc
* Txn puts the **payment on hold** as it is **subject to further review** by the Txn Compliance team
* The Txn **Compliance team decides** whether the payment must be rejected and sent back to the originator or if it can be released
* If the latter, Txn applies the **spot exchange rate** to the received amount of crypto
* The merchant receives the result of the currency conversion

<figure><img src="https://1963856601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgfUDRstNYYBTf2futZ28%2Fuploads%2F2FNoyMMPxR1uSdJUBBzL%2Fimage.png?alt=media&#x26;token=3d265858-c55c-4030-9903-7b1b877aae6f" alt=""><figcaption></figcaption></figure>
