# Invoice payment sequence

Invoice payment sequence.

<figure><img src="https://files.cryptopay.me/b2b/git_book_files/08_Invoice_Invoice_Payment_Sequence.svg" alt=""><figcaption></figcaption></figure>

Once an invoice is created, we start monitoring its cryptocurrency address to detect inbound transactions.

1. The customer specifies a purchase amount and purchase currency (if necessary)
2. The merchant makes an API call `POST /api/invoices` to [create an invoice](https://reference.cryptopay.me/#tag/Invoices/operation/invoices.create)
3. Cryptopay responds with the invoice details
4. The merchant displays the payment details to the customer (a destination wallet address, an exact amount to send, a QR code etc)
5. The customer broadcasts a cryptocurrency transaction
6. Cryptopay sends the 1st callback to notify the merchant about the fact that the customer has just broadcast their transaction
7. Cryptopay is waiting for the transaction to be confirmed on the network
8. Cryptopay sends the 2nd callback to notify the merchant about the fact that the transaction has been confirmed
9. Cryptopay changes the invoice status from `new` to `completed` and sends the final callback
10. The merchant makes an API call `GET /api/invoices/:id` to retrieve the invoice status
11. The invoice status is returned
12. The merchant marks the payment as successful on their side


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.cryptopay.me/guides/invoices/payment-sequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
