Get Payment Intent
Retrieve details of a payment intent by its ID.
GET
https://api.zenpayz.com/api/v1/payment-intents/{intentId}Bearer · API key
Request
Path Parameters
| Parameter | Type | Description |
|---|---|---|
intentId REQUIRED | string | Payment intent ID (e.g., pi_xxxxx) |
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 |
note
For GET requests, use an empty object {} when calculating the signature.
Response
Success (200 OK)
{
"success": true,
"data": {
"intentId": "pi_1771910100598_prckpcg01",
"status": "succeeded",
"amount": 100,
"currency": "INR",
"transactionId": "txn_abc123",
"externalTransactionId": "ext_xyz789",
"createdAt": "2026-02-24T05:15:00.599Z",
"completedAt": "2026-02-24T05:16:30.000Z",
"metadata": {},
"events": [
{
"event": "payment_intent.created",
"timestamp": "2026-02-24T05:15:00.599Z"
},
{
"event": "payment_intent.confirmed",
"timestamp": "2026-02-24T05:15:05.000Z"
},
{
"event": "payment_intent.succeeded",
"timestamp": "2026-02-24T05:16:30.000Z"
}
]
},
"message": "Payment intent retrieved successfully",
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-02-24T05:17:00.000Z",
"processing_time_ms": 45,
"api_version": "v1",
"endpoint": "GET /payment-intent/:intentId"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| UNAUTHORIZED | 401 | Invalid API key |
| PAYMENT_INTENT_NOT_FOUND | 404 | Payment intent doesn't exist |
Examples
- cURL
- JavaScript
- Python
- SDK (Recommended)
curl -X GET "https://api.zenpayz.com/api/v1/payment-intents/pi_1234567890abcdef" \
-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"
const crypto = require('crypto');
const apiKey = process.env.ZENPAYS_API_KEY;
const secretSalt = process.env.ZENPAYS_SECRET_SALT;
const timestamp = new Date().toISOString();
const intentId = 'pi_1234567890abcdef';
// For GET requests, use empty object
const signature = crypto
.createHmac('sha256', secretSalt)
.update(timestamp + '{}')
.digest('hex');
const response = await fetch(
`https://api.zenpayz.com/api/v1/payment-intents/${intentId}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
},
}
);
const result = await response.json();
console.log(result.data.status); // "succeeded"
import hmac
import hashlib
import os
from datetime import datetime
import requests
api_key = os.environ["ZENPAYS_API_KEY"]
secret_salt = os.environ["ZENPAYS_SECRET_SALT"]
timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.000Z")
intent_id = "pi_1234567890abcdef"
# For GET requests, use empty object
data = timestamp + "{}"
signature = hmac.new(
secret_salt.encode(),
data.encode(),
hashlib.sha256
).hexdigest()
response = requests.get(
f"https://api.zenpayz.com/api/v1/payment-intents/{intent_id}",
headers={
"Authorization": f"Bearer {api_key}",
"X-Timestamp": timestamp,
"X-Signature": signature,
"X-Secret-Salt": secret_salt,
},
)
result = response.json()
print(result["data"]["status"]) # "succeeded"
// JavaScript SDK - handles authentication automatically
const intent = await zenpays.payments.getPaymentIntent('pi_1234567890abcdef');
console.log(intent.status); // "succeeded"
Payment Intent Status
| Status | Description |
|---|---|
requires_payment_method | Awaiting payment method selection |
processing | Payment is being processed |
succeeded | Payment completed successfully |
failed | Payment failed |
cancelled | Payment was cancelled |
expired | Payment intent expired |