Browser SDK
One script, no build step, no dependency:
<script src="https://cashvya.com/cashvya.js"></script>
It exposes Cashvya (and the alias CashvyaCheckout) on
window, and opens the checkout in an iframe modal — a centred panel on desktop, a
bottom sheet on mobile. The modal can only be dismissed with its close button, so a stray tap
outside does not abandon a payment in progress.
Zero-JavaScript button
Configure on the script tag, then mark any element with
data-cashvya-pay. Clicks are bound automatically.
<script src="https://cashvya.com/cashvya.js"
data-cashvya-key="YOUR_PUBLIC_MERCHANT_ID"
data-currency="INR"
data-name="Your Store"
data-theme-color="#10b981"
data-success-url="/thank-you"></script>
<button data-cashvya-pay
data-order-id="ORDER-1042"
data-amount="499.00"
data-description="Premium plan">
Pay ₹499
</button>
| Script attribute | Purpose |
|---|---|
data-cashvya-key | Your public merchant id. Not the secret key. |
data-currency | Defaults to INR |
data-name | Store name shown in the modal |
data-theme-color | Accent colour |
data-success-url, data-failed-url, data-cancelled-url, data-expired-url | Where to send the customer on each outcome |
Button attributes: data-order-id, data-amount,
data-currency, data-name, data-description.
With a button, the amount is set in the browser and can be edited by the customer before the
request is sent. For anything that matters, create the payment on your server and pass the
paymentId — or switch off browser-created payments in your dashboard.
Cashvya.pay(options)
The recommended form: your server creates the payment, the browser only opens it.
const { paymentId } = await fetch('/api/checkout', { method: 'POST' }).then(r => r.json());
Cashvya.pay({
paymentId,
onSuccess(result) {
// UI only. Fulfil from the webhook on your server.
window.location = '/thank-you?order=' + result.order_id;
},
onFailed(result) { showError(result.reason); },
onCancelled() { showMessage('Payment cancelled'); },
onExpired() { showMessage('Payment window expired'); },
onClose() { /* modal closed, for any reason */ }
});
| Option | Type | Notes |
|---|---|---|
paymentId | string | From your server. Preferred. |
checkoutUrl | string | Alternative to paymentId: open this URL directly. |
key | string | Public merchant id, when letting the SDK create the payment |
orderId / order_id | string | Defaults to a generated ORDER-<timestamp> |
amount | number / string | Rupees |
currency, name, description | string | Display and payload details |
customer | object | { name, email, phone } |
metadata | object | Echoed back in the webhook |
theme | object | { color: '#10b981' } |
handler | function | Alias of onSuccess |
onSuccess, onFailed, onSuspicious, onExpired, onCancelled, onClose | function | Outcome callbacks |
successUrl, failedUrl, suspiciousUrl, expiredUrl, cancelledUrl | string | Redirect instead of, or after, the callback |
Result object
{
status: 'SUCCESS',
payment_id: '7f3c1e62-...',
order_id: 'ORDER-1042',
payment_mode: 'UPI',
amount_received: 499,
utr: '429913847265',
timestamp: '2026-10-31T06:12:40.112Z',
metadata: { }
}
DOM events
If callbacks do not suit your architecture, the same outcomes are dispatched on
both window and document:
window.addEventListener('cashvya:payment:success', e => console.log(e.detail));
cashvya:payment:success, :failed, :suspicious,
:expired, :cancelled, and cashvya:payment:result which
fires for every outcome.
The SDK only accepts messages from its own checkout iframe and origin, so a spoofed success message from another window is ignored.
Server side
There is no server package to install. The API is two HTTP calls, so use your language's HTTP client.
PHP
$ch = curl_init('https://cashvya.com/api/v1/payments');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CASHVYA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'orderId' => $orderId,
'amount' => number_format($total, 2, '.', ''),
]),
]);
$payment = json_decode(curl_exec($ch), true);
header('Location: ' . $payment['checkoutUrl']);
Python
import os, requests
payment = requests.post(
'https://cashvya.com/api/v1/payments',
headers={'Authorization': f"Bearer {os.environ['CASHVYA_API_KEY']}"},
json={'orderId': order.id, 'amount': f'{order.total:.2f}'},
timeout=15,
).json()
return redirect(payment['checkoutUrl'])
See the API Reference for every field, and Webhooks for verification code in Node, PHP and Python.
Other platforms
There is no official plugin yet. On any PHP site, including WordPress and
WooCommerce, the browser SDK plus a webhook handler is enough — create the payment in your
server-side code, open it with Cashvya.pay({ paymentId }), and verify the webhook as
shown above.
If you want a plugin for a specific platform, tell us at [email protected].