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

# Buy and sell

> The quote-then-confirm flow a user goes through to buy or sell crypto.

Buying and selling share the same flow: pick a side and an amount, get a quote with a rate guaranteed for a short window, then confirm.

<Steps>
  <Step title="Amount">
    The user toggles between **Buy** and **Sell**, picks an asset, and enters an amount — either typed or from a preset chip. A reference rate is shown, but it isn't guaranteed until the next step.

    <Frame>
      <img src="https://mintcdn.com/ripio-9dfd4837/Ntx12LxEM0pFyETw/crypto-as-a-service/widget/assets/widget-buy-amount.png?fit=max&auto=format&n=Ntx12LxEM0pFyETw&q=85&s=cb8b00e4220ce2e8729d4fd179545310" alt="Step 1: choosing an asset and an amount" width="951" height="579" data-path="crypto-as-a-service/widget/assets/widget-buy-amount.png" />
    </Frame>
  </Step>

  <Step title="Quote">
    The widget requests a quote and shows the guaranteed rate, the fee, and the amount the user will receive, together with a countdown. While it's running, the rate holds.

    <Frame>
      <img src="https://mintcdn.com/ripio-9dfd4837/Ntx12LxEM0pFyETw/crypto-as-a-service/widget/assets/widget-buy-quote.png?fit=max&auto=format&n=Ntx12LxEM0pFyETw&q=85&s=41c3836ecc6299656be4cbb7223d8ee3" alt="Step 2: reviewing the quote before confirming" width="951" height="504" data-path="crypto-as-a-service/widget/assets/widget-buy-quote.png" />
    </Frame>

    If the countdown reaches zero before the user confirms, the widget automatically requests a new quote and shows a banner explaining the rate refreshed.
  </Step>

  <Step title="Result">
    Confirming shows a processing state, then either success — with a receipt the user can view — or an error with the option to retry.
  </Step>
</Steps>

### Buy needs your approval

Before a **buy** executes, the widget asks your backend to approve it — the operation only goes through once you respond. See [Webhooks](/crypto-as-a-service/widget/webhooks#transaction_approval_request) for the request your endpoint receives and how to respond to it.

A **sell** doesn't need approval: Ripio holds the custody of the crypto being sold, so there's nothing on your side to authorize before it executes. You still receive the result once it's done.

### After the operation

Either way, your backend receives a `transaction_result` webhook once the operation resolves — successfully or not — so you can update your own records of the user's balance. See [Webhooks](/crypto-as-a-service/widget/webhooks#transaction_result).

The operation also appears in the user's [Activity](/crypto-as-a-service/widget/flows/home#activity), where they can open it to see its detail and download a receipt.
