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

# How Prava Works

> The lifecycle behind every Prava payment — from intent to a completed checkout.

Prava sits between the party that wants to pay (an app or an AI agent) and the merchant. Its job is
to keep the sensitive parts (the real card, the spending rules, the final authorization) out of the
caller's hands, while still letting the payment go through.

## The core idea

An app or agent never holds a real card number. Instead it works with **permission to spend** and, at
the moment of purchase, a **one-time credential** that only works for that exact purchase.

```mermaid theme={null}
flowchart LR
    A["App or AI agent<br/>proposes a purchase"]
    B["Prava<br/>secure card entry<br/>owner's limits applied<br/>network authorization"]
    C["Merchant<br/>checkout completes"]
    A -->|purchase request| B -->|one-time credential| C
```

## The lifecycle

**1. A purchase is proposed**

An app creates a **session** for a specific order, or an agent creates a payment for a known
merchant and total. The amount and merchant are pinned up front.

**2. The card is collected securely**

The cardholder enters their card in Prava's secure surface: an embedded iframe (SDK) or a hosted
page (Prava Pay). The raw card number never reaches the app, the agent, or their servers.

**3. The owner's rules are applied**

Prava checks the purchase against the account's guardrails (spending limits, approvals, saved
addresses) before anything is charged. See [Guardrails](https://docs.prava.space/concepts/guardrails.md).

**4. A one-time credential is issued**

Prava returns credentials scoped to that single purchase: locked to the merchant, the amount, and a
short time window. They can't be reused or repurposed.

**5. Checkout completes**

The credential is used at the merchant's checkout to complete the payment. The outcome is confirmed
from the payment itself, so the status you get back is the real one.

## Why it's safe by design

> [card] No raw card exposure
>
> The card is entered in Prava's secure surface and tokenized (the number is replaced with a secure
> stand-in). Apps and agents never see it.

> [card] Scoped credentials
>
> What the caller receives works for **one** purchase: right merchant, right amount, short-lived.

> [card] Owner-set guardrails
>
> Spending limits and approvals are enforced by Prava on every purchase, not by the caller.

> [card] No silent double-charge
>
> If an outcome is ever uncertain, Prava declines to guess rather than risk charging twice.

## Three ways to integrate

The same lifecycle powers all three integration paths:

| | [Embedded](https://docs.prava.space/sdk/integration-modes.md) | [Hosted](https://docs.prava.space/sdk/integration-modes.md#hosted-mode-default) | [Agent](https://docs.prava.space/prava-pay/overview.md) |
| - | - | - | - |
| Runs in | Your web app (SDK) | Your backend (API) | An AI agent, via [MCP](https://docs.prava.space/mcp/overview.md) or the CLI |
| Card entry | Iframe inside your page | Prava-hosted page (redirect) | Prava-hosted page |
| Best for | Native checkout in your product | Fast, minimal-frontend checkout | Agents buying on someone's behalf |

Not sure which to pick? See [Choosing Your Integration](https://docs.prava.space/choosing-your-integration.md). For the money-side
details (mandates, credential scoping, and status), see [Payments](https://docs.prava.space/concepts/payments.md). For the
controls an owner sets, see [Guardrails](https://docs.prava.space/concepts/guardrails.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.