# Create a deposit

Creates an INR deposit and returns the generated payment instructions.

## Request fields

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `webhook_url` | URL | Yes | Valid public URL | Receives deposit status postbacks |
| `return_url` | URL | No | Valid URL | Customer redirect after payment |
| `amount` | Number | Yes | INR 100 to 50,000 | Deposit amount |
| `transaction_id` | String | Yes | Non-empty and unique | Your merchant transaction ID |
| `customer_id` | String | No | Non-empty if provided | Your customer identifier |
| `customer_name` | String | No | Non-empty after trimming | Customer name forwarded to supported providers |
| `customer_email` | String | No | Valid email | Customer email forwarded to supported providers |
| `customer_mobile` | String | No | Exactly 10 digits | Customer mobile number |
| `traffic_type` | String | No | `ftd` or `trusted` | Optional traffic classification |

## cURL example

```bash
curl -X POST https://api.niripay.com/api/v1/merchant/deposits/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://merchant.example/webhooks/deposit",
    "return_url": "https://merchant.example/payment-complete",
    "amount": 1000,
    "transaction_id": "TXN123456789",
    "customer_id": "CUSTOMER-101"
  }'
```

## JavaScript example

```js
const deposit = await niripayJson("/api/v1/merchant/deposits/create", {
  webhook_url: "https://merchant.example/webhooks/deposit",
  return_url: "https://merchant.example/payment-complete",
  amount: 1000,
  transaction_id: "TXN123456789",
  customer_id: "CUSTOMER-101"
});
```

## Success response

```json
{
  "status": "success",
  "message": "Deposit created successfully",
  "data": {
    "payment_page": "https://pay.niripay.com/pay/abc123def456ghi789",
    "intent_url": "upi://pay?pa=merchant@upi&am=1000&cu=INR",
    "is_native": false,
    "transaction_id": "TXN123456789",
    "internal_transaction_id": "abc123def456ghi789",
    "amount": 1000,
    "fees": {
      "percentage": 3,
      "fixed_amount": 2,
      "total_amount": 32.0,
      "net_credit_amount": 968.0
    }
  }
}
```

## Important rules

- Each create request must use a new `transaction_id`.
- The minimum amount is INR 100 and the maximum is INR 50,000.
- Persist both `transaction_id` and `internal_transaction_id`.
- Store the create response before redirecting the customer.
