> For the complete documentation index, see [llms.txt](https://developers.cryptopay.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.cryptopay.me/guides/invoices/payment-sequence.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
