> ## Documentation Index
> Fetch the complete documentation index at: https://docs.breet.io/llms.txt
> Use this file to discover all available pages before exploring further.

# E-commerce

> Add crypto checkout to your online store and auto-settle payments to your local bank account with the Breet API.

Add crypto as a payment method at checkout. Breet generates a unique wallet address per order, tracks the payment on-chain, and notifies your store when the transaction is confirmed so you can fulfill the order.

## How it works

<Steps>
  <Step title="Generate an address for the order">
    When a customer selects crypto at checkout, call the [generate-address](/api-reference/crypto-wallet/generate-wallet-address) endpoint with the order ID as the `label`. This creates a dedicated deposit address tied to that order.
  </Step>

  <Step title="Display payment instructions">
    Show the wallet address, expected amount, and a QR code on your checkout page. The customer sends crypto from any wallet.
  </Step>

  <Step title="Receive a webhook confirmation">
    Breet sends a [webhook](/webhooks) when the payment is confirmed on-chain. Match the deposit to the order using the `label` or `destinationAddress`.
  </Step>

  <Step title="Fulfill the order">
    Once the webhook confirms full payment, update the order status and begin fulfillment.
  </Step>

  <Step title="Settle funds (optional)">
    How funds are handled after a payment depends on your setup:

    * **Without auto-settlement**: payments are converted and held in your wallet in your chosen currency (USD, NGN, or GHS). You can view the balance on your dashboard and withdraw manually whenever you're ready.
    * **With per-address auto-settlement**: each payment is automatically converted and paid out to the bank account linked to that specific address. Enable it via the API. See the [auto-settlement guide](/auto-settlement).
    * **With business-wide auto-settlement**: all payments across all addresses are automatically withdrawn to a single destination (bank account). Enable it from your dashboard under **Settings > Automatic Settlement**.

    You can set your preferred holding currency from the dashboard under **Settings > Crypto Settings**.
  </Step>
</Steps>

## Generate an address per order

```bash theme={null}
curl -X POST "https://api.breet.io/v1/trades/sell/assets/ASSET_ID/generate-address" \
  -H "x-app-id: YOUR_APP_ID" \
  -H "x-app-secret: YOUR_APP_SECRET" \
  -H "X-Breet-Env: production" \
  -H "Content-Type: application/json" \
  -d '{"label": "order-98765"}'
```

Replace `ASSET_ID` with a [supported asset](/supported-assets) you want to accept for this order. The `label` field ties the address to your order ID, making reconciliation straightforward when the webhook arrives.

<Tip>
  Generate a fresh address for every order. This makes it easy to match payments to orders without relying on amount matching.
</Tip>

## What Breet handles

* Generating unique wallet addresses per order
* Monitoring blockchains for incoming payments
* Sending webhook notifications with payment details
* Converting crypto to local fiat via auto-settlement
* Payouts to your business bank account

## What you handle

* Adding crypto as a payment option in your checkout flow
* Displaying the wallet address, amount, and QR code to the customer
* Listening for and processing webhook events
* Matching payments to orders using the `label` or address
* Handling order fulfillment after payment confirmation
* Managing underpayments or overpayments in your order logic

## Example user journey

1. Fatima adds items to her cart on an online store and proceeds to checkout.
2. She selects **Pay with crypto** and chooses USDT on Solana.
3. The store calls Breet's [generate-address](/api-reference/crypto-wallet/generate-wallet-address) endpoint with `label: "order-98765"` and displays the wallet address with the amount due.
4. Fatima sends the exact USDT amount from her wallet.
5. Breet detects the payment and sends a `trade.completed` webhook to the store's server.
6. The store matches the webhook to order 98765, marks it as paid, and begins shipping.
7. The crypto payment is held in the store's wallet balance (or auto-settled to the store's bank account if enabled).

## FAQ

<AccordionGroup>
  <Accordion title="Can I generate an address per order?">
    Yes. Each call to the [generate-address](/api-reference/crypto-wallet/generate-wallet-address) endpoint returns a unique wallet address. Pass your order ID in the `label` field so incoming payments are automatically mapped to the correct order when the webhook fires.
  </Accordion>

  <Accordion title="What if the customer underpays?">
    Breet reports the exact amount received in the webhook payload. If the amount is less than the order total, the webhook still fires with the partial amount. Your application should compare the received amount against the order total and decide how to handle it. You can prompt the customer to send the remaining balance, or cancel the order based on your business rules.
  </Accordion>

  <Accordion title="Can I accept payments from customers globally?">
    Yes. Crypto payments are borderless by nature. Any customer with a crypto wallet can send funds to the generated address regardless of their location. No additional configuration is needed for international payments.
  </Accordion>

  <Accordion title="How long should I keep the checkout page open?">
    Blockchain confirmation times vary by network. Fast networks like Solana typically confirm in seconds, while Bitcoin may take 5–60 minutes. Use the `trade.pending` webhook to show the customer that their payment has been detected, and `trade.completed` to confirm it. Consider setting a reasonable timeout and allowing customers to retry if the payment window expires.
  </Accordion>
</AccordionGroup>
