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

# Payment SDK

> Accept payments with @agentaos/pay — create checkouts, track payments, manage webhooks.

# Payment SDK

```bash theme={null}
npm install @agentaos/pay
```

## Create a checkout

```typescript theme={null}
import { AgentaOS } from '@agentaos/pay';

const client = new AgentaOS('sk_live_your-key');

const checkout = await client.checkouts.create({
  amount: 50,
  currency: 'EUR',
  description: 'Consulting fee',
});

console.log(checkout.checkoutUrl);  // share with customer
console.log(checkout.x402Url);      // for AI agents
```

## Retrieve

```typescript theme={null}
const session = await client.checkouts.retrieve('session-id');
console.log(session.status); // open, completed, expired, cancelled
```

## List

```typescript theme={null}
const { items, total } = await client.checkouts.list({
  status: 'completed',
  limit: 10,
});
```

## Auth

The SDK auto-detects auth type:

* `sk_live_...` or `sk_test_...` → API key (`x-api-key` header)
* JWT token → Bearer auth (`Authorization` header)
