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

# API Reference

> Ababil x402 Payment Gateway — accept USDC payments across EVM chains and Solana through a single API.

<Note>
  Ababil has launched **Testnet v1**. All APIs on this page are live and ready to use on testnet.
</Note>

## What is Ababil?

Ababil is a **payment infrastructure built on the x402 protocol**. It gives merchants a dashboard and a developer API to accept USDC payments across Arc, Base, Ethereum, and Solana — all from one integration.

When a buyer pays using a merchant's API key, the USDC settles directly into that merchant's dashboard wallet. No intermediaries, no custodial accounts — funds land peer-to-peer. AI agents can pay autonomously using EIP-3009 signed authorizations, requiring nothing beyond a private key.

Ababil acts as the **Facilitator** in the x402 protocol triangle:

<CardGroup cols={3}>
  <Card title="Merchant" icon="store">
    Uses the Ababil dashboard and API key to create payment intents. Received funds settle directly into the merchant's dashboard wallet.
  </Card>

  <Card title="Buyer" icon="user">
    Human or AI agent that signs a USDC transfer authorization. No token approvals needed.
  </Card>

  <Card title="Ababil" icon="shield-check">
    Verifies the EIP-3009 signature and relays `transferWithAuthorization` on-chain. Never holds funds.
  </Card>
</CardGroup>

## Base URLs

| Environment    | Base URL                          | Status |
| -------------- | --------------------------------- | ------ |
| **Testnet v1** | `https://testnetv1.ababilpay.xyz` | ✅ Live |

All API endpoints are prefixed with `/api/v1`:

```
https://testnetv1.ababilpay.xyz/api/v1
```

The hosted checkout page (buyer-facing UI) is served at:

```
https://testnetv1.ababilpay.xyz/pay/{intent_id}
```

## Integration Paths

Ababil supports two integration patterns. Both start from the same intent creation endpoint.

<CardGroup cols={2}>
  <Card title="Hosted Gateway" icon="arrow-up-right-from-square" href="/api-reference/hosted-gateway">
    Redirect buyers to Ababil's hosted checkout page. Wallet connect, signing, and settlement are fully managed. Recommended for human buyers. **\~1 hour** to integrate.
  </Card>

  <Card title="Custom Integration" icon="code" href="/api-reference/custom-integration">
    Build your own payment UI. Your frontend signs the EIP-3009 authorization; Ababil verifies and settles on-chain. Required for AI agents and white-label UIs. **\~1 day** to integrate.
  </Card>
</CardGroup>

|                   | Hosted Gateway                       | Custom Integration                       |
| ----------------- | ------------------------------------ | ---------------------------------------- |
| Frontend work     | None — redirect to Ababil URL        | Build wallet connect + signing UI        |
| Backend work      | Create intent, redirect, poll status | Create intent, relay signature to `/pay` |
| Supported wallets | MetaMask, Coinbase Wallet, Phantom   | Any wallet you connect                   |
| AI agent support  | ✗ Requires a browser                 | ✓ Sign with private key                  |
| White-label UI    | ✗ Ababil-branded page                | ✓ Fully custom                           |
| Integration time  | \~1 hour                             | \~1 day                                  |

## Endpoints at a Glance

| Method   | Endpoint                              | Description                         |
| -------- | ------------------------------------- | ----------------------------------- |
| `POST`   | `/api/v1/x402/intents`                | Create a payment intent             |
| `GET`    | `/api/v1/x402/intents/{id}`           | Get intent status and details       |
| `GET`    | `/api/v1/x402/intents`                | List intents with filters           |
| `DELETE` | `/api/v1/x402/intents/{id}`           | Cancel a pending intent             |
| `POST`   | `/api/v1/x402/pay`                    | Settle payment (custom integration) |
| `POST`   | `/api/v1/x402/intents/{id}/solana-tx` | Build unsigned Solana transaction   |
