An invoice is a request for a cryptocurrency payment which is linked to its unique cryptocurrency address and the amount that has to be paid while the invoice is valid.
The invoice amount can be expressed either in cryptocurrency or fiat currency.
As cryptocurrency payments are made over a separate network, when creating an invoice, we generate a unique payment address for each cryptocurrency so we can match customers to their payments. When a customer makes a cryptocurrency payment, the transaction is then broadcast to the cryptocurrency network for validation/confirmation.
Once the invoice is created, we start monitoring its unique address to identify the incoming transaction. Invoices have statuses and each time the invoice changes its status, Cryptopay sends callbacks to the Callback URL.
Every time the customer sends cryptocurrency to the invoice address, we send the first callback with the transaction_created event. It means that the payment has just been identified, but it has not been validated by the network yet. When the transaction is completely verified and confirmed by the network, we send another callback with the transacion_confirmed event, and the invoice automatically changes its status from new to completed.
The invoice is only valid for a limited time (10 minutes max). This is due to the fact that for each invoice Cryptopay freezes the exchange rate for 10 minutes.
In some cases, customers make payments after the invoice has expired. In this case, the invoice status will be updated to unresolved with the paid_late context.
There are also cases where customers may overpay or underpay the invoices. When this happens, the invoice changes its status to unresolved with an overpaid or underpaid context. In any of the above user scenarios, the unresolved payment status can be updated to completed or refunded manually, or Cryptopay will automatically update the status as soon as the payment is validated by the network if the appropriate settings have been selected on the Settings > API > How to handle unresolved invoices in your account.