# Checkout and Settlement Flows

The payment domain uses an asynchronous mechanism that decouples checkout creation from on-chain detection and final settlement, allowing each phase to proceed independently.

***

### **Checkout Flow**

The merchant calls `createCryptoCheckout` with the payment parameters: amount, currency, participant code, buyer info, purpose metadata, and an expiry timestamp. The system generates a checkout session and returns a payment target (address and chain details).&#x20;

The buyer transfers the specified amount to this target. If the payment is not received before the expiry window elapses, the session transitions to an expired state. If payment is detected, the session advances to settlement processing. Merchants can look up any session at any time using the `clientReference` they provided at creation.

***

### **Settlement Flow**

Once an inbound transfer is detected and confirmed on-chain, the system matches it against the active checkout session. The confirmed amount, transaction hash, source chain, and block confirmation count are recorded. Funds are then settled into the merchant's participant account.&#x20;

The checkout status is updated to reflect settlement, and all transaction details are available through a single normalized query via `getCryptoCheckout`. Unlike ramp flows, payment settlements are scoped entirely to the checkout session and do not require separate claim transactions.


---

# 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://city-protocol.gitbook.io/docs/neofinance-as-a-service/payment-module/checkout-and-settlement-flows.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.
