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

# Checkout

# Checkout Implementation

fype provides a managed, hosted checkout page that simplifies the payment process for both developers and customers.

## How it Works

1. **Initiation**: Your server creates a payment via `POST /v1/payments`.
2. **Redirection**: You receive a `checkout_url`. Redirect your customer to this URL.
3. **Interactions**: On the checkout page, fype handles:

* Displaying order details (Amount, Merchant Name).
* Providing the appropriate payment methods for the selected gateway.
* Handling the gateway's client-side SDK (e.g., Razorpay Checkout).
* Managing 3D Secure / OTP redirects.

4. **Completion**: Once the payment is processed, fype redirects the customer back to your `success_url` or `cancel_url`.

## Success & Cancel URLs

When creating a payment, you must provide `success_url` and `cancel_url`. fype allows you to use placeholders in these URLs which will be dynamically replaced upon redirection.

### Supported Placeholders

| Placeholder             | Replaced With                        |
| :---------------------- | :----------------------------------- |
| `{CHECKOUT_SESSION_ID}` | The UUID of the checkout session.    |
| `{PAYMENT_ID}`          | The UUID of the fype payment record. |

**Example:**
If your `success_url` is `https://example.com/thanks?order={PAYMENT_ID}`, the customer will be redirected to:
`https://example.com/thanks?order=550e8400-e29b-41d4-a716-446655440000`

## Customizing the Checkout Experience

fype is designed for zero-configuration checkout. The merchant name and logo (if configured) are automatically pulled from your account settings.

## Security

The `checkout_url` is a public URL. However, the data returned by the checkout session endpoint is strictly limited to public identifiers (like your Gateway Public Key ID and Order Reference). Sensitive data like your Gateway Secret Key never leaves fype's backend.

## The Simulator (Test Mode)

When using a `fype_test_` key, the checkout page enters **Simulator Mode**. Instead of loading a real gateway, it displays interactive simulation options:

* **Simulate Success**: Instantly transitions the payment to `succeeded` and triggers a `payment.succeeded` webhook.
* **Simulate Card Decline**: Transitions the payment to `failed` and triggers a `payment.failed` webhook.
* **Simulate UPI Timeout**: Simulates a countdown and eventual abandonment of the transaction.

This allows you to test your entire integration lifecycle without configuring a gateway or using real payment cards.
