Get Payment Link
Retrieve a single payment link by its ID.
GET
https://api.zenpayz.com/merchant/api/v1/payment-links/:linkIdBearer · API key
Request
Headers
| Header | Description |
|---|---|
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 |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
linkId REQUIRED | string | The payment link ID (e.g. pl_a1b2c3d4e5f6g7h8) |
Response
Success (200 OK)
{
"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 retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 25,
"api_version": "v1",
"endpoint": "GET /payment-links/:linkId",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| UNAUTHORIZED | 401 | Invalid API key |
| PAYMENT_LINK_NOT_FOUND | 404 | Payment link does not exist |
Examples
- cURL
- JavaScript
- SDK
curl -X GET https://api.zenpayz.com/merchant/api/v1/payment-links/pl_a1b2c3d4e5f6g7h8 \
-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"
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/payment-links/pl_a1b2c3d4e5f6g7h8', {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'Content-Type': 'application/json',
},
});
const result = await response.json();
console.log(result.data.title); // "Pro Plan Payment"
console.log(result.data.shortUrl); // "https://pay.zenpayz.com/s/ZP-XYZ789"
const link = await zenpays.paymentLinks.get('pl_a1b2c3d4e5f6g7h8');
console.log(link.title); // "Pro Plan Payment"
console.log(link.shortUrl); // "https://pay.zenpayz.com/s/ZP-XYZ789"