Skip to content
ZytePedevelopersDashboard
DocsAPI reference
API reference

Create Hosted Payment

Creates a ZytePe hosted checkout session and returns the checkout URL for customer redirect.

POST/payments/createPlugin signed
Use your enabled merchant account. Examples run on your server, never in this documentation.

Authentication

Use plugin-signed headers. The signature scheme differs from merchant HMAC. Local source clarifies Unix-second timestamps and hexadecimal output; confirm deployment compatibility.

See authentication.

Workflow notes

  • Sign with X-ZytePe-Api-Key, X-ZytePe-Timestamp, and X-ZytePe-Signature.
  • Canonical string is timestamp + "." + METHOD + "." + PATH + "." + raw_body.
  • Redirect the customer to checkout_url and store payment_id on the order.

Before you send

Check the field labels and use your enabled merchant account. Examples illustrate the API contract; confirm deployment-specific limits and error handling before launch. This page never sends a request.

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"
}