4.3.6 • Published 12 months ago

cashfree-pg v4.3.6

Weekly downloads
-
License
Apache
Repository
github
Last release
12 months ago

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

4.3.10

12 months ago

4.3.6

12 months ago

4.3.5

12 months ago

4.3.1

1 year ago

4.3.0

1 year ago

4.2.3

1 year ago

4.2.2

1 year ago

4.2.0

1 year ago

4.1.2

2 years ago

4.0.9

2 years ago

4.0.10

2 years ago

4.0.7

2 years ago

3.2.15

2 years ago

3.2.14

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

3.2.12

2 years ago

4.0.3

2 years ago

3.2.7

2 years ago

3.2.1

2 years ago

3.2.3

2 years ago

3.2.0

2 years ago

4.0.2

2 years ago

4.0.0

2 years ago

3.1.4

2 years ago

3.1.3

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.8

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago