Skip to content
ZytePedevelopersDashboard
Accept payments

Hosted checkout

Create a payment session and connect checkout completion to your order.

Create a session

From your backend, call Create hosted payment using plugin-signed headers. Supply your merchant ID, order reference, amount and customer details. Currency defaults to INR. The return URL, callback URL, expiry and metadata are optional; see the labelled example below.

Redirect the customer

Store payment_id against your order and redirect the customer to checkout_url returned by ZytePe. Use the returned URL instead of constructing a payment URL yourself.

Confirm payment on the server

A browser return is not payment confirmation. Use the callback to update your backend and Hosted payment status for recovery or support checks. Its source example uses status paid; do not assume other APIs use the same casing or vocabulary.

Handle cancellations and refunds

Retain provider and transaction references for investigation. For a paid hosted payment, see the refund workflow. Confirm merchant/product enablement before using the flow with customers.

Request example

Choose Node.js, Python, PHP, Ruby, Java or cURL. Run signed requests on your backend. PHP, Ruby and Java include signing directly. Java requires JDK 17 or newer.

import { pluginSignedHeaders } from './plugin-signing.mjs';
const path = `/payments/create`;
const query = '';
const payload = {
  "merchant_id": "MERCHANT_001",
  "order_id": "ORDER_123",
  "amount": "499.00",
  "currency": "INR",
  "customer": {
    "name": "Rahul Sharma",
    "email": "rahul@example.com",
    "phone": "9876543210"
  },
  "return_url": "https://store.example.com/zytepe/return",
  "callback_url": "https://store.example.com/wp-json/zytepe/v1/webhook",
  "expires_in_minutes": 1440,
  "metadata": {
    "platform": "woocommerce"
  }
};
const body = JSON.stringify(payload);
const headers = pluginSignedHeaders({
  method: 'POST', path, body,
  keyId: process.env.ZYTEPE_API_KEY_ID,
  secret: process.env.ZYTEPE_API_SECRET,
});
headers['Content-Type'] = 'application/json';
const url = 'https://api.zytepe.com' + path + (query ? '?' + query : '');
const response = await fetch(url, { method: 'POST', headers, body });
if (!response.ok) throw new Error('Request failed: HTTP ' + response.status);
const result = await response.json();
// Store the returned identifiers securely. Do not log customer data.

Request fields

Optional fields can be omitted. Conditional fields depend on the payment method. Labels reflect the reviewed API schemas and handler checks.

merchant_idRequired

Your merchant identifier.

order_idRequired

Your order reference.

amountRequired

Payment amount in the documented currency.

customerRequired

Customer identity details.

customer.nameRequired

Required customer detail.

customer.emailRequired

Required customer detail.

customer.phoneRequired

Required customer detail.

currencyOptional

Defaults to INR.

return_urlOptional

Customer return destination. A return is not payment confirmation.

callback_urlOptional

Payment callback destination.

expires_in_minutesOptional

Defaults to 1440 minutes.

metadataOptional

Additional order context.

Request body

JSON · request.json
{
  "merchant_id": "MERCHANT_001",
  "order_id": "ORDER_123",
  "amount": "499.00",
  "currency": "INR",
  "customer": {
    "name": "Rahul Sharma",
    "email": "rahul@example.com",
    "phone": "9876543210"
  },
  "return_url": "https://store.example.com/zytepe/return",
  "callback_url": "https://store.example.com/wp-json/zytepe/v1/webhook",
  "expires_in_minutes": 1440,
  "metadata": {
    "platform": "woocommerce"
  }
}

Example response

JSON · response
{
  "payment_id": "pay_123",
  "checkout_url": "https://pay.zytepe.com/pay_123",
  "status": "created",
  "order_id": "ORDER_123",
  "amount": "499.0000",
  "currency": "INR"
}

Explore the business workflow: Payment gateway overview.