Skip to main content

Payments

Create and manage payment intents, confirm payments, and track transactions. Access via zenpays.payments.

Payment Intents​

createPaymentIntent​

const intent = await zenpays.payments.createPaymentIntent({
amount: 500,
currency: 'INR',
customerEmail: '[email protected]',
customerPhone: '+911234567890',
customerCountry: 'IN',
description: 'Order #12345',
returnUrl: 'https://yoursite.com/complete',
})

getPaymentIntent​

const intent = await zenpays.payments.getPaymentIntent('pi_xxx')

getPublicPaymentIntent​

const intent = await zenpays.payments.getPublicPaymentIntent('pi_xxx', 'optional_token')

confirmPayment​

const result = await zenpays.payments.confirmPayment('pi_xxx', {
customerDetails: {
name: 'John Doe',
email: '[email protected]',
phone: '+911234567890',
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​

const { data, total } = await zenpays.payments.listTransactions({
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'
)

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
}