Payments
Create and manage payment intents, confirm payments, and track transactions. Access via zenpays.payments.
Payment Intents
createPaymentIntent
- JavaScript
- Python
const intent = await zenpays.payments.createPaymentIntent({
amount: 500,
currency: 'INR',
customerEmail: 'customer@example.com',
customerPhone: '+911234567890',
customerCountry: 'IN',
description: 'Order #12345',
returnUrl: 'https://yoursite.com/complete',
})
intent = zenpays.payments.create_payment_intent({
"amount": 500,
"currency": "INR",
"customerEmail": "customer@example.com",
"description": "Order #12345",
})
getPaymentIntent
const intent = await zenpays.payments.getPaymentIntent('pi_xxx')
getPublicPaymentIntent
const intent = await zenpays.payments.getPublicPaymentIntent('pi_xxx', 'optional_token')
confirmPayment
- JavaScript
- Python
const result = await zenpays.payments.confirmPayment('pi_xxx', {
customerDetails: {
name: 'John Doe',
email: 'john@example.com',
phone: '+911234567890',
address: { country: 'IN' },
},
paymentMethodDetails: {
paymentMethod: 'FIAT',
paymentType: 'UPI',
},
confirmSource: 'MERCHANT_SITE',
})
result = zenpays.payments.confirm_payment("pi_xxx", {
"customerDetails": {
"name": "John Doe",
"email": "john@example.com",
"address": {"country": "IN"},
},
"paymentMethodDetails": {
"paymentMethod": "FIAT",
"paymentType": "UPI",
},
"confirmSource": "MERCHANT_SITE",
})
processPayment
const result = await zenpays.payments.processPayment('pi_xxx', confirmRequest)
cancelPaymentIntent
const intent = await zenpays.payments.cancelPaymentIntent('pi_xxx')
updateIntelligence
await zenpays.payments.updateIntelligence('pi_xxx', {
userAgent: navigator.userAgent,
screenWidth: window.screen.width,
screenHeight: window.screen.height,
})
Transactions
getTransaction
const txn = await zenpays.payments.getTransaction('txn_xxx')
getTransactionsByIntent
const transactions = await zenpays.payments.getTransactionsByIntent('pi_xxx')
listTransactions
- JavaScript
- Python
const { data, total } = await zenpays.payments.listTransactions({
status: 'success',
from: '2024-01-01',
to: '2024-12-31',
limit: 50,
})
result = zenpays.payments.list_transactions({
"status": "success",
"from": "2024-01-01",
"to": "2024-12-31",
"limit": 50,
})
getTransactionAnalytics
const analytics = await zenpays.payments.getTransactionAnalytics('30d')
exportTransactions
const downloadUrl = await zenpays.payments.exportTransactions(
{ status: 'success', from: '2024-01-01' },
'csv' // or 'xlsx'
)
UPI Deep Link (INR Only)
getUpiDeepLink
Extract the upi:// deep link from a TSP payment page QR code. Used for INR payments to enable direct UPI app opening on mobile.
const result = await zenpays.payments.getUpiDeepLink(
'pi_xxx',
'https://cashier.ppco.lol?orderNo=C123', // payPageUrl from confirm response
'C123' // cashierOrderNo (optional)
)
if (result.success && result.data.upiDeepLink) {
window.location.href = result.data.upiDeepLink // Opens UPI app on mobile
}