
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@dhanyatra/checkout-js
Advanced tools
A web checkout module to invoke instant payment.
Dhanyatra Checkout-JS is a JavaScript library tailored for seamless integration with Dhanyatra's payment gateway. It empowers developers to effortlessly incorporate Dhanyatra's payment features into their applications. By offering a clean and intuitive API, Dhanyatra Checkout-JS simplifies the process of handling payments, providing businesses with a robust solution for processing transactions and enhancing the checkout experience for customers.
Install the package from the npm registry as follows:
npm i @dhanyatra/checkout-js
# yarn
yarn add @dhanyatra/checkout-js
# pnpm
pnpm add @dhanyatra/checkout-js
The module exposes a Dhanyatra
class, which can be used to payment server and listen for payments events.
import { Dhanyatra } from '@dhanyatra/checkout-js';
const options = {
key: 'Mw.9BnMszEkdEOE8OYmSPA0-IvISRHJCkUUKalSR_keJ2zWT9vFQtUsgfXM2ryn', // Enter the Key ID generated from the Dashboard
amount: '500', // Any amount can be float
currency: 'INR', // Currently only INR accepted
organization: "Hustler's Academy", // Name to be displayed of organization
image: 'https://i.imgur.com/n5tjHFD.png', // Logo to be displayed of organization
handler: function (response) {
//response after payment event either Success or Failed
alert(response.dhanyatra_payment_id);
},
modal: {
//Modal Handler inside payment gateway
ondismiss: function () {
//Dismiss Modal Handler
let txt = '';
if (confirm('Are you sure, you want to close the form?')) {
txt = 'You pressed OK!';
console.log('Checkout form closed by the user');
rzp1.close();
} else {
txt = 'You pressed Cancel!';
console.log('Complete the Payment');
}
},
},
}
// Setup Dhanyatra options
const dhanyatra = new Dhanyatra(options)
// Trigger Payment
dhanyatra.open();
Using the package as script tag on HTML
<script type="module">
import { Dhanyatra } from 'https://www.unpkg.com/@dhanyatra/checkout-js@0.0.2/build/checkout.modern.js';
const options = {
key: 'Mw.9BnMszEkdEOE8OYmSPA0-IvISRHJCkUUKalSR_keJ2zWT9vFQtUsgfXM2ryn', // Enter the Key ID generated from the Dashboard
amount: '500', // Any amount can be float
currency: 'INR', // Currently only INR accepted
organization: "Hustler's Academy", // Name to be displayed of organization
image: 'https://i.imgur.com/n5tjHFD.png', // Logo to be displayed of organization
handler: function (response) {
//response after payment event either Success or Failed
alert(response.dhanyatra_payment_id);
},
modal: {
//Modal Handler inside payment gateway
ondismiss: function () {
//Dismiss Modal Handler
let txt = '';
if (confirm('Are you sure, you want to close the form?')) {
txt = 'You pressed OK!';
console.log('Checkout form closed by the user');
rzp1.close();
} else {
txt = 'You pressed Cancel!';
console.log('Complete the Payment');
}
},
},
}
// Setup Dhanyatra options
const dhanyatra = new Dhanyatra(options)
// Trigger Payment
dhanyatra.open();
<script type="module">
FAQs
Check Js Module For Instant Web Checkout
The npm package @dhanyatra/checkout-js receives a total of 17 weekly downloads. As such, @dhanyatra/checkout-js popularity was classified as not popular.
We found that @dhanyatra/checkout-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.