<!-- ZenPays documentation · https://docs.zenpays.com/docs/rest-api/endpoints/payouts/create-payout -->

# Create Payout

:::danger[Deprecated — Do Not Use]
This endpoint is **deprecated** and will be removed in a future release. It is no longer maintained and may produce unexpected behavior.

**Use [Payout Intents](/docs/rest-api/endpoints/payout-intents/create-payout-intent) instead.** Payout Intents provide a more reliable, two-step flow with preview, confirmation, smart routing, and full webhook support.
:::

Create a new payout to transfer funds to a beneficiary.

<EndpointHeader verb="POST" path="/merchant/api/v1/payouts" />

## Request

### Headers

<ParamTable
  label="Header"
  rows={[
    { name: "Authorization", required: true, desc: "`Bearer {api_key}`" },
    { name: "X-Signature", required: true, desc: "HMAC-SHA256 signature" },
    { name: "X-Timestamp", required: true, desc: "ISO 8601 timestamp" },
    { name: "X-Secret-Salt", required: true, desc: "Secret salt for HMAC validation" },
    { name: "Content-Type", required: true, desc: "`application/json`" },
    { name: "X-Idempotency-Key", desc: "Unique key to prevent duplicates" },
  ]}
/>

### Body Parameters

<ParamTable
  rows={[
    { name: "beneficiaryAccount", type: "string", required: true, desc: "Beneficiary account number (5-100 chars)" },
    { name: "beneficiaryName", type: "string", required: true, desc: "Beneficiary name (2-200 chars)" },
    { name: "amount", type: "number", required: true, desc: "Payout amount (minimum 1)" },
    { name: "payoutType", type: "string", required: true, desc: "Payout type: `IMPS`, `NEFT`, `RTGS`, or `UPI`" },
    { name: "currency", type: "string", desc: "3-character currency code (default: `INR`)" },
    { name: "country", type: "string", desc: "2-character ISO country code" },
    { name: "beneficiaryIfsc", type: "string", desc: "IFSC code (for bank transfers in India)" },
    { name: "beneficiaryVpa", type: "string", desc: "UPI VPA (required for UPI payouts)" },
    { name: "beneficiarySwift", type: "string", desc: "SWIFT code (for international transfers)" },
    { name: "beneficiaryBic", type: "string", desc: "BIC code" },
    { name: "beneficiaryRoutingNumber", type: "string", desc: "Routing number" },
    { name: "beneficiaryEmail", type: "string", desc: "Beneficiary email address" },
    { name: "beneficiaryMobile", type: "string", desc: "Beneficiary mobile number" },
    { name: "beneficiaryAddress", type: "string", desc: "Beneficiary address" },
    { name: "beneficiaryCity", type: "string", desc: "Beneficiary city" },
    { name: "beneficiaryState", type: "string", desc: "Beneficiary state" },
    { name: "beneficiaryPostalCode", type: "string", desc: "Beneficiary postal code" },
    { name: "beneficiaryBankCode", type: "string", desc: "Beneficiary bank code" },
    { name: "beneficiaryAccountType", type: "string", desc: "Account type: `CHECKING`, `SAVINGS`, or `CURRENT`" },
    { name: "bankName", type: "string", desc: "Bank name" },
    { name: "purpose", type: "string", desc: "Purpose of the payout" },
    { name: "description", type: "string", desc: "Payout description" },
    { name: "customerId", type: "string", desc: "Associated customer ID" },
    { name: "webhookUrl", type: "string", desc: "URL for payout status webhooks" },
    { name: "metadata", type: "object", desc: "Custom key-value pairs" },
  ]}
/>

### Payout Types

| Type | Description | Supported Countries |
|------|-------------|---------------------|
| `IMPS` | IMPS transfer | India |
| `NEFT` | NEFT transfer | India |
| `RTGS` | RTGS transfer | India |
| `UPI` | UPI transfer | India |

## Response

### Success (201 Created)

```json
{
  "success": true,
  "data": {
    "payoutId": "pay_xxxxx",
    "merchantId": "mer_xxxxx",
    "amount": 10000,
    "currency": "INR",
    "status": "processing",
    "externalPayoutId": "pout_xxxxx",
    "processingFee": 25,
    "totalDebitedAmount": 10025,
    "estimatedCompletion": "2024-01-15T11:00:00.000Z",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "metadata": {}
  }
}
```

### Error Responses

<ErrorTable
  rows={[
    { code: "INVALID_AMOUNT", status: "400", message: "Amount below minimum or above maximum" },
    { code: "INVALID_BENEFICIARY", status: "400", message: "Invalid beneficiary details" },
    { code: "UNAUTHORIZED", status: "401", message: "Invalid API key" },
    { code: "INSUFFICIENT_BALANCE", status: "402", message: "Wallet balance too low" },
    { code: "PAYOUT_FAILED", status: "422", message: "Payout processing failed" },
  ]}
/>

<CodeRail>

## Examples

<Tabs groupId="language">
  <TabItem value="curl" label="cURL" default>

```bash
curl -X POST https://api.zenpays.com/merchant/api/v1/payouts \
  -H "Authorization: Bearer zp_test_xxxxx" \
  -H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
  -H "X-Signature: a1b2c3d4e5f6..." \
  -H "X-Secret-Salt: your_secret_salt" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: payout-order-123" \
  -d '{
    "amount": 10000,
    "currency": "INR",
    "country": "IN",
    "payoutType": "IMPS",
    "beneficiaryAccount": "1234567890",
    "beneficiaryIfsc": "HDFC0001234",
    "beneficiaryName": "John Doe"
  }'
```

  </TabItem>
  <TabItem value="javascript" label="JavaScript">

```javascript
const payout = await fetch('https://api.zenpays.com/merchant/api/v1/payouts', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'X-Timestamp': timestamp,
    'X-Signature': signature,
    'X-Secret-Salt': secretSalt,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 10000,
    currency: 'INR',
    country: 'IN',
    payoutType: 'IMPS',
    beneficiaryAccount: '1234567890',
    beneficiaryIfsc: 'HDFC0001234',
    beneficiaryName: 'John Doe',
  }),
});
```

  </TabItem>
  <TabItem value="sdk" label="SDK">

```javascript
const payout = await zenpays.payouts.create({
  amount: 10000,
  currency: 'INR',
  country: 'IN',
  payoutType: 'IMPS',
  beneficiaryAccount: '1234567890',
  beneficiaryIfsc: 'HDFC0001234',
  beneficiaryName: 'John Doe',
});

console.log(payout.payoutId); // pay_xxxxx
```

  </TabItem>
</Tabs>

</CodeRail>

## Payout Status

| Status | Description |
|--------|-------------|
| `pending` | Payout created, awaiting processing |
| `processing` | Being processed by TSP |
| `succeeded` | Funds transferred successfully |
| `failed` | Payout failed |
| `cancelled` | Payout was cancelled |
| `reversed` | Payout was reversed |

## Related Endpoints

- [Get Payout](/docs/rest-api/endpoints/payouts/get-payout)
- [List Payouts](/docs/rest-api/endpoints/payouts/list-payouts)
- [Preview Payout](/docs/rest-api/endpoints/payouts/preview-payout)
