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

# POST Initiate Payment

> Start a payment transaction.

## Initiate payment

`POST /api/payment/initiate`

Initiate a payment for a subscription plan.

### Headers

**Cookie** `string` *required*

Session cookie (login via POST /api/auth/login)

### Body parameters

**planId** `integer` *required*

Plan to purchase.

**gateway** `string` *required*

Payment gateway (`stripe`, `razorpay`, `paypal`, `paystack`, `mercadopago`).

**successUrl** `string`

Redirect URL on success.

**cancelUrl** `string`

Redirect URL on cancel.

```json theme={null}
{
  "planId": 2,
  "gateway": "stripe",
  "successUrl": "https://your-app.com/success",
  "cancelUrl": "https://your-app.com/cancel"
}
```

### Response (Stripe)

```json Response theme={null}
{
  "success": true,
  "data": {
    "sessionId": "cs_abc123...",
    "url": "https://checkout.stripe.com/c/pay/cs_abc123..."
  }
}
```

### Response (Razorpay)

```json Response theme={null}
{
  "success": true,
  "data": {
    "orderId": "order_abc123",
    "key": "rzp_live_...",
    "amount": 2999,
    "currency": "INR"
  }
}
```

***

## Get payment status

`GET /api/payment/status/:transactionId`

**transactionId** `string` *required*

Transaction ID.

```bash cURL theme={null}
curl https://zeplo.ai/api/payment/status/txn_123 \
  -H "Cookie: connect.sid=s%3A7HImZ-T2BxWSbUsf9dtWdOlBW4rVuORO.5J0Do0NyvBu%2BkTvu1aHvtNs00BKhkpUKTwiokLS0cpw"
```


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