# E2E Purchase Flow

Canonical URL: https://magiccard.ai/docs/guides/e2e-purchase
Markdown URL: https://magiccard.ai/docs/guides/e2e-purchase.md
Summary: The built-in agent clarifies intent, searches providers, selects a channel, uses MagicBrowse or an agentic protocol, and raises user requests during the session.
Description: How the built-in MagicPay agent turns a user payment intent into a completed purchase session.

## Canonical Answer

The built-in agent clarifies intent, searches providers, selects a channel, uses MagicBrowse or an agentic protocol, and raises user requests during the session. How the built-in MagicPay agent turns a user payment intent into a completed purchase session. Protected payment and identity data stays behind MagicPay requests instead of entering LLM-visible context.

![A purchase from intent to receipt](https://magiccard.ai/docs-assets/images/guides-e2e-purchase-flow.svg)

## Flow

The end-to-end purchase flow starts from a user intent and ends with a completed session or an explicit stop reason.

1. User asks the built-in agent to complete a purchase or payment intent.
2. The agent checks previous payment operations and infers the full payment prompt when possible.
3. If required data is missing, the agent asks clarifying questions.
4. MagicSearch returns ranked provider candidates with rating, geography, and payment channel availability.
5. The agent chooses a provider and channel, preferring agentic protocols, then public API/MCP, reverse API/MCP, and legacy browser checkout.
6. If no candidate is found, the agent falls back to agentic web search.
7. MagicBrowse or the selected payment protocol executes the flow while MagicPay delivers requests to the user.

Note: Done when: the session reaches a completed payment, or it stops with an explicit reason you can act on.

## During The Session

The user receives requests for approvals, choices, Memory reads, Memory writes, and payment confirmation through enabled channels.

## Completion

The session records events, payment results, and any learned hints that can improve future purchase sessions.

## Related

- MagicSearch: https://magiccard.ai/docs/components/magicsearch
- MagicBrowse: https://magiccard.ai/docs/components/magicbrowse
- Omnichannel UI: https://magiccard.ai/docs/components/omnichannel-ui