Cashfree Payment Gateway - Web SDK (cashfree.js v3)

Integrate Cashfree.js v3 checkout, Elements, and saved-card payments into web frontends.

Updated Sep 8, 2026
One-click install
npx skills add https://github.com/dasara-varun/orange --skill cashfree-payment-gateway-web-sdk-cashfree-js-v3-dasara-varun
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Cashfree Payment Gateway - Web SDK (cashfree.js v3)
Source: https://github.com/dasara-varun/orange/tree/main/.cursor/cashfree-skills/pg/web-sdk
Command: npx skills add https://github.com/dasara-varun/orange --skill cashfree-payment-gateway-web-sdk-cashfree-js-v3-dasara-varun

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Integrating Cashfree Payments into a browser-based checkout requires choosing between Drop-in, Elements/Headless, and redirect modes, handling three-state Promise resolutions, and avoiding common mistakes like trusting client-side payment results or mixing Elements with checkout(). This Skill provides the decision matrices, code patterns, and security rules to wire cashfree.js v3 correctly the first time. ## Core Features & Use Cases - Three Checkout Modes: Guidance for Drop-in (cashfree.checkout with _modal/_self/_top/_blank), Elements/Headless (cashfree.create + cashfree.pay with cardNumber, cardCvv, cardExpiry, cardHolder components), and pure redirect flows. - SPA & Framework Wiring: React, Vue, Next.js, and Angular integration patterns covering script loading, mount/unmount lifecycle, CSP configuration, and SSR boundaries. - Saved Cards & OneClick: Token Vault integration using instrument_id with cashfree.pay for returning-customer checkout. - Use Case: A React storefront needs a custom-designed card form. Mount Cashfree Elements components in useEffect, submit via cashfree.pay with the paymentSessionId, then backend-verify the order status before fulfilling. ## Quick Start Ask the AI to integrate Cashfree Drop-in checkout into your web page using a paymentSessionId from your backend, with proper handling of the error, redirect, and paymentDetails result states.

Frequently Asked Questions about Cashfree Payment Gateway - Web SDK (cashfree.js v3)

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate Cashfree checkout into a React or Next.js app?▼

Load https://sdk.cashfree.com/js/v3/cashfree.js once, create the Cashfree instance with mode sandbox or production, then call cashfree.checkout with your paymentSessionId. In React, mount Elements inside useEffect and destroy components on unmount; in Next.js use a client component.

What is the difference between cashfree.checkout and cashfree.pay?▼

cashfree.checkout opens Cashfree's Drop-in UI in a modal or redirect, while cashfree.pay submits a headless payment using mounted Elements components or a saved-card instrument_id. Never mix them: an Elements form must submit via cashfree.pay, not checkout.

Can I use the Cashfree web SDK in mobile apps or Flutter?▼

No, the cashfree.js v3 web SDK only runs in browsers and does not work inside native mobile shells. For Android, iOS, React Native, or Flutter, use the Cashfree mobile SDKs instead.

Why does cashfree.checkout return session_expired?▼

The paymentSessionId expires after roughly 15 minutes. Create a fresh order on your backend each time the customer enters checkout instead of caching the session id across page loads.

Is it safe to fulfill an order based on the SDK payment result?▼

No, the client-side result only proves a payment attempt occurred, not that the bank approved it. Always re-verify from your backend with GET /pg/orders/{order_id} and fulfill only when order_status is PAID.

How do I implement saved cards or OneClick checkout with Cashfree?▼

Fetch the customer's saved instruments from your backend via the Token Vault APIs, render your own selector, then call cashfree.pay with paymentMethod containing channel link and the chosen instrument_id. Some BINs require collecting CVV again.