Invoice State Machine

|State| Sent as | Description |


|Billed| "billed" | A request for payment has been made, but a payment method has not been selected. Therefore, no payment address or spot rate has been assigned, and the expiration timer has not started. |

|Unpaid| "unpaid" | A request for payment has been made, the payment method has been declared, and the expiration timer is ticking. |

|Paid | "paid" | Payment has been received in full, but has not been confirmed on the blockchain |

| Ready to Ship | "ready_to_ship" | The Payment is confirmed on the blockchain and the merchant. Typically, this is when the merchant releases the goods to the customer. |

|Fulfilled| "fulfilled" |An optional state that merchants can use for internal tracking|

|Underpaid | "underpaid" | A payment has been received, but does not fulfill the request for payment at the given exchange rate |

|Merchant Review | "merchant_review" | The Expiration window has passed, and the invoice was either underpaid, or a payment was received late|

|Refunded | "refunded" | A Merchant requested that a refund be issued for the invoice |

|Invalid | "invalid" |  Any payment on the invoice was flagged as invalid|

*Note: an invoice never passes into an 'Expired' state - the expiration window is based on the value of* `"expires_at"` *in the Invoice.*

Invoice Events

The following events are monitored within GoCoin and can generate Webhooks:

| Event       | Trigger                                     |

| ----------- | ------------------------------------------- |

| invoice_created     | Sent when an invoice is created |      

| invoice_payment_received  |  Payment is detected and unconfirmed on the network  |

| invoice_ready_to_ship   | Payment(s) confirmed for the full amount of the invoice            |

| invoice_merchant_review   | A Payment was received after the payment window, or the invoice expired while underpaid. Contact [support]( to resolve.  |

| invoice_invalid | Invalid payments detected. Purchaser may be attempting to double spend Bitcoin.       |