Socket
Socket
Sign inDemoInstall

cashfree-pg

Package Overview
Dependencies
18
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cashfree-pg

Cashfree client for cashfree-pg


Version published
Maintainers
1
Created

Readme

Source

Cashfree PG Node SDK

GitHub Discord GitHub last commit (branch) GitHub release (with filter) npm GitHub forks Coverage Status

The Cashfree PG Node SDK offers a convenient solution to access Cashfree PG APIs from a server-side JavaScript applications.

Documentation

Cashfree's PG API Documentation - https://docs.cashfree.com/reference/pg-new-apis-endpoint

Learn and understand payment gateway workflows at Cashfree Payments here

Try out our interactive guides at Cashfree Dev Studio !

Getting Started

Installation

npm i cashfree-pg

Configuration

import { Cashfree } from "cashfree-pg"; 

Cashfree.XClientId = "<x-client-id>";
Cashfree.XClientSecret = "<x-client-secret>";
Cashfree.XEnvironment = Cashfree.Environment.SANDBOX;

Generate your API keys (x-client-id , x-client-secret) from Cashfree Merchant Dashboard

Basic Usage

Create Order

var request = {
    "order_amount": 1,
    "order_currency": "INR",
    "order_id": "order_34692745",
    "customer_details": {
        "customer_id": "walterwNrcMi",
        "customer_phone": "9999999999"
    },
    "order_meta": {
        "return_url": "https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}"
    }
};
Cashfree.PGCreateOrder("2022-09-01", request).then((response) => {
    console.log('Order Created successfully:',response.data)
}).catch((error) => {
    console.error('Error:', error.response.data.message);
});

Get Order

Cashfree.PGFetchOrder("2022-09-01", "<order_id>").then((response) => {
    console.log('Order fetched successfully:', response.data);
}).catch((error) => {
    console.error('Error:', error.response.data.message);
});

Validate Webhook

app.post('/webhook', function (req, res) {
    try {
        Cashfree.PGVerifyWebhookSignature(req.headers["x-webhook-signature"], req.rawBody, req.headers["x-webhook-timestamp"]))
    } catch (err) {
        console.log(err.message)
    }
})

Supported Resources

Licence

Apache Licensed. See LICENSE.md for more details

Keywords

FAQs

Last updated on 01 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc