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

# Depot Payments

> How to integrate Depot e-money payments

## Overview

Depot is a **redirect-based** e-money payment method. After creating a payment via API, redirect the customer to `payment_url` to complete the payment.

## Requirements

| Requirement    | Value                                                                    |
| -------------- | ------------------------------------------------------------------------ |
| Currency       | **JPY only**                                                             |
| Amount         | **Positive integer** (whole yen). Decimal amounts are rejected           |
| Refund / Void  | Not available through the API — contact support                          |
| Payment status | Delivered by webhook only; there is no status polling endpoint for Depot |

Pass `customer_id`, `email`, `tel` and `product_name` when you have them: they are shown to the customer on the payment page.

## Payment Flow

<Steps>
  <Step title="Create Payment">
    Call `POST /v1/payments` to create a payment and obtain `payment_url`
  </Step>

  <Step title="Redirect Customer">
    Redirect customer to `payment_url`
  </Step>

  <Step title="Customer Completes Payment">
    Customer completes payment on Depot's page
  </Step>

  <Step title="Redirect Back">
    Customer is redirected to your `success_redirect_url` or `failure_redirect_url`
  </Step>

  <Step title="Verify Result">
    Optionally verify payment status using Get Payment API
  </Step>
</Steps>

## Implementation Example

```javascript theme={null}
// 1. Create payment via API
const response = await fetch('https://api.sandbox.zafapay.com/v1/payments', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    amount: 1000,          // whole yen only — decimals are rejected
    currency: 'jpy',       // Depot settles in JPY
    external_id: 'order_12345',
    product_name: 'Premium Plan',
    customer_id: 'cus_001',
    email: 'customer@example.com',
    tel: '08000000000'
  })
});

const payment = await response.json();

// 2. Redirect customer to Depot payment page
window.location.href = payment.payment_url;
```

## Webhook Integration

For reliable payment confirmation, set up webhooks:

```javascript theme={null}
// Webhook handler
app.post('/webhooks/zafapay', async (req, res) => {
  const { event, external_id } = req.body;

  if (event === 'payment.succeeded') {
    // Update order status
    await updateOrder(external_id, 'paid');
  }

  res.json({ received: true });
});
```

<Info>
  For complete API parameters and response details, see the [Create Payment](/api-reference/payments/create-payment) API reference.
</Info>
