<!-- ZenPays documentation · https://docs.zenpayz.com/docs/reference/objects/checkout-session -->

# The CheckoutSession object

Represents a checkout session for payment processing. Checkout sessions are created to initiate a payment flow and can be used for hosted checkout pages or embedded payment experiences.

## Fields

<ParamTable
  label="Field"
  rows={[
    { name: "id", type: "string", required: true, desc: "Unique identifier for the checkout session" },
    { name: "merchantId", type: "string", required: true, desc: "ID of the merchant who created the session" },
    { name: "playerId", type: "string", required: true, desc: "ID of the player/user making the payment" },
    { name: "amount", type: "number", required: true, desc: "Payment amount in the source currency" },
    { name: "targetSettlementAsset", type: "string", required: true, desc: "Target cryptocurrency for settlement (e.g., 'USDC')" },
    { name: "status", type: "'created' | 'active' | 'completed' | 'cancelled' | 'expired'", required: true, desc: "Current status of the checkout session" },
    { name: "paymentIntentId", type: "string", required: false, desc: "Associated payment intent ID (if payment initiated)" },
    { name: "rampOrderId", type: "string", required: false, desc: "Associated ramp order ID (if on-ramp initiated)" },
    { name: "successUrl", type: "string", required: false, desc: "URL to redirect on successful payment" },
    { name: "cancelUrl", type: "string", required: false, desc: "URL to redirect on cancelled payment" },
    { name: "paymentPageUrl", type: "string", required: false, desc: "URL to the hosted payment page" },
    { name: "expiresAt", type: "string", required: false, desc: "ISO 8601 timestamp when the session expires" },
    { name: "createdAt", type: "string", required: true, desc: "ISO 8601 timestamp when the session was created" },
    { name: "updatedAt", type: "string", required: true, desc: "ISO 8601 timestamp when the session was last updated" },
  ]}
/>

## Example

```json
{
  "id": "obj_1a2b3c",
  "merchantId": "merchant_1a2b3c",
  "playerId": "player_1a2b3c",
  "amount": 5000,
  "targetSettlementAsset": "string",
  "status": "created",
  "paymentIntentId": "paymentintent_1a2b3c",
  "rampOrderId": "ramporder_1a2b3c",
  "createdAt": "2026-01-15T09:30:00Z",
  "updatedAt": "2026-01-15T09:30:00Z"
}
```

## Usage

```typescript
const session = await client.checkout.create({
  playerId: 'player_123',
  amount: 100,
  targetSettlementAsset: 'USDC',
  successUrl: 'https://myapp.com/success'
});
// Redirect user to session.paymentPageUrl
```
