Skip to main content

Create Payment Link

Create a new payment link that can be shared with customers to collect payments.

POSThttps://api.zenpayz.com/merchant/api/v1/payment-links
Bearer · API key

Request

Headers

HeaderDescription
Authorization
REQUIRED
Bearer {api_key}
X-Signature
REQUIRED
HMAC-SHA256 signature
X-Timestamp
REQUIRED
ISO 8601 timestamp
X-Secret-Salt
REQUIRED
Secret salt for HMAC validation
Content-Type
REQUIRED
application/json

Body Parameters

ParameterTypeDescription
title
REQUIRED
stringPayment link title (1-255 characters)
description
OPTIONAL
stringPayment link description
amount
REQUIRED
numberPayment amount (minimum 0.01)
currency
OPTIONAL
stringCurrency code (default: INR)
usageType
OPTIONAL
stringUsage type (default: SINGLE). One of SINGLE, MULTI
maxUses
OPTIONAL
numberMaximum number of uses (minimum 1, only for MULTI type)
expiresAt
OPTIONAL
stringExpiration date (ISO 8601)
productId
OPTIONAL
stringAssociated product ID
customerId
OPTIONAL
stringAssociated customer ID
invoiceId
OPTIONAL
stringAssociated invoice ID
invoiceIds
OPTIONAL
string[]Array of associated invoice IDs
metadata
OPTIONAL
objectCustom key-value pairs

Response

Success (201 Created)

{
"success": true,
"data": {
"linkId": "pl_a1b2c3d4e5f6g7h8",
"title": "Pro Plan Payment",
"description": "Payment for Pro Plan subscription",
"amount": 4999,
"currency": "INR",
"status": "ACTIVE",
"usageType": "SINGLE",
"maxUses": null,
"usageCount": 0,
"expiresAt": "2024-02-15T23:59:59.000Z",
"productId": "prod_a1b2c3d4e5f6g7h8",
"customerId": null,
"invoiceId": null,
"paymentUrl": "https://pay.zenpayz.com/pl_a1b2c3d4e5f6g7h8",
"shortCode": "ZP-XYZ789",
"shortUrl": "https://pay.zenpayz.com/s/ZP-XYZ789",
"metadata": {},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
},
"message": "Payment link created successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 55,
"api_version": "v1",
"endpoint": "POST /payment-links",
"user_type": "merchant"
}
}

Error Responses

CodeHTTPMessage
VALIDATION_ERROR400Invalid request parameters
UNAUTHORIZED401Invalid API key
PRODUCT_NOT_FOUND404Associated product does not exist
INVOICE_NOT_FOUND404Associated invoice does not exist

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/payment-links \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json" \
-d '{
"title": "Pro Plan Payment",
"description": "Payment for Pro Plan subscription",
"amount": 4999,
"currency": "INR",
"usageType": "SINGLE",
"expiresAt": "2024-02-15T23:59:59.000Z",
"productId": "prod_a1b2c3d4e5f6g7h8"
}'