Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
@cashfreepayments/cashfree-sdk
Advanced tools
Readme
Cashfree libraries are released in Beta. This is work in progress and we are continuously working on improving various aspects of it. It is released as a learning aid and an example kit for the API integrators.
This is not recommended by Cashfree for direct use in production code. Please report any bugs to Cashfree at techsupport@cashfree.com.
The official Cashfree SDK for JavaScript, available for Node.js backends. Node version 10.9.0 was used for this SDK.
Get started quickly using Cashfree with the Cashfree SDK for JavaScript in Node.js. The SDK helps take the complexity out of coding by providing JavaScript objects for Cashfree services including Payouts, Payment Gateway, Marketplace and Autocollect. The single, downloadable package includes the Cashfree JavaScript Library and documentation.
Please refer to the Cashfree Docs for the complete API reference.
The preferred way to install the Cashfree SDK for Node.js is to use the npm package manager for Node.js. Simply type the following into a terminal window:
npm i @cashfreepayments/cashfree-sdk
Your IP has to be whitelisted to hit Cashfree's server. Or if you have a dynamic IP please pass in the public key parameter during the init method as shown below. For more information please go here.
The package needs to be configured with your account's secret key which is available in your Cashfree Dashboard.
const { Payouts } = require('@cashfreepayments/cashfree-sdk');
// Instantiate Cashfree Payouts
const payoutsInstance = new Payouts({
env: 'TEST',
clientId: '<CLIENT_ID>',
clientSecret: '<CLIENT_SECRET>',
});
const { Payouts } = require('@cashfreepayments/cashfree-sdk');
// Instantiate Cashfree Payouts
const payoutsInstance = new Payouts({
env: 'TEST',
clientId: '<CLIENT_ID>',
clientSecret: '<CLIENT_SECRET>',
pathToPublicKey: '/path/to/your/public/key/file.pem',
//"publicKey": "ALTERNATIVE TO SPECIFYING PATH (DIRECTLY PASTE PublicKey)"
});
Option | Default | Description |
---|---|---|
env | TEST | Environment to be initialized. Can be set to TEST or PRODUCTION |
clientId | `` | clientId which can be generated on cashfree dashboard. |
clientSecret | `` | clientSecret which can be found alongside generated ClientId . |
pathToPublicKey | `` | Either specify the path to your .pem public key file or use publicKey Param and pass the key there. |
publicKey | `` | Pass your Public Key to this parameter as an alternative to pathToPublicKey . |
To verify the webhook received from Cashfree for different events and accept the webhook only when it returns true
.
Pass the webhook received along with the payload type.
Payouts.verifySignature(webhookPostDataJson, signature, clientSecret); // returns true or false
Every method returns a promise which can be used:
payoutsInstance.beneficiary
.add({
beneId: 'JOHN18012',
name: 'john doe',
email: 'johndoe@cashfree.com',
phone: '9876543210',
bankAccount: '00001111222233',
ifsc: 'HDFC0000001',
address1: 'ABC Street',
city: 'Bangalore',
state: 'Karnataka',
pincode: '560001',
})
.then(function (response) {
console.log(response);
});
async function addBeneficiary() {
try {
const response = await payoutsInstance.beneficiary.add({
beneId: 'JOHN18012',
name: 'john doe',
email: 'johndoe@cashfree.com',
phone: '9876543210',
bankAccount: '00001111222233',
ifsc: 'HDFC0000001',
address1: 'ABC Street',
city: 'Bangalore',
state: 'Karnataka',
pincode: '560001',
});
console.log(response);
} catch (e) {
console.error(e);
}
}
FAQs
Official Node SDK for Cashfree API
The npm package @cashfreepayments/cashfree-sdk receives a total of 407 weekly downloads. As such, @cashfreepayments/cashfree-sdk popularity was classified as not popular.
We found that @cashfreepayments/cashfree-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.