Skip to main content

Overview

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

Payment Flow

1

Create Payment

Call POST /v1/payments to create a payment and obtain payment_url
2

Redirect Customer

Redirect customer to payment_url
3

Customer Completes Payment

Customer completes payment on Depot’s page
4

Redirect Back

Customer is redirected to your success_redirect_url or failure_redirect_url
5

Verify Result

Optionally verify payment status using Get Payment API

Implementation Example

// 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,
    currency: 'usd',
    external_id: 'order_12345'
  })
});

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:
// Webhook handler
app.post('/webhooks/zafapay', async (req, res) => {
  const event = req.body;

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

  res.json({ received: true });
});
For complete API parameters and response details, see the Create Payment API reference.