cashfree / cashfree-sdk-nodejs Goto Github PK
View Code? Open in Web Editor NEWCashfree SDK for Node js
License: MIT License
Cashfree SDK for Node js
License: MIT License
Firebase cloud function on Cashfree PG gateway failed with error: Cannot encode value.
Reason: path: undefined (inside class PG)
this.path variable is undefined inside Http call of PaymentGateway constructor.
Resolution: Either path has to be initialized as null or string.empty
Error thrown by SDK:
{"level":"error","message":"error validating bank details, "TypeError: Cannot read property 'token' of undefined\n at Auth.authorize (/Users/mohak.gupta/curefit/payment-service/node_modules/cashfree-sdk/lib/auth/index.js:81:40)\n at process._tickCallback (internal/process/next_tick.js:68:7)"","timestamp":"2020-09-03 18:22:41","iID":"CF-LP00286.local","pID":35728,"rID":"e2b3f034-7361-40c9-8074-05ed0306419c"}
Actual API response:
{
"status": "ERROR",
"subCode": "403",
"message": "IP not whitelisted"
}
The given example for bank validation fails with ERR_UNESCAPED_CHARACTERS if the name field contains a space
Validation.ValidateBankDetails({
name: "JOHN SMITH",
phone: "9908712345",
bankAccount: "026291800001191",
ifsc: "YESB0000262"
}).then(function(d){
console.log(d)
});
It seems that the parameters sent via HTTPS to the Cashfree API are not URL-encoded and cause issues if they contain special characters such as space.
https://github.com/cashfree/cashfree-sdk-nodejs/blob/master/Payouts/Validation/index.js#L20
Will be great to include typescript typings
Error thrown by SDK:
TypeError: Cannot read property 'token' of undefined\n at Auth.authorize
"IP not whitelisted"
ENV: TEST
I'm using dynamic IP for API calls, so instead of IP whitelisting, I'm using a public key.
Also, as a side note, I haven't added any IP in the whitelisting field on the test dashboard.
var headers = {
'Content-Type': 'application/json',
'x-api-version': '2022-01-01',
'x-client-id': 'perfect id',
'x-client-secret': 'perfect secret'
};
var dataString = `{
"order_id": "o26945143520",
"order_amount": 10,
"order_currency": "INR",
"order_note": "Additional order info",
"customer_details": {
"customer_id": "ASFS12345",
"customer_email": "[email protected]",
"customer_phone": "9816512345"
}
}`;
var options = {
url: 'https://sandbox.cashfree.com/pg/orders',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
console.log(body)
}
request(options, callback);
**Output**
{"message":"Rate limiting not configured","code":"request_failed","type":"internal_error"} `
-- In the documentation, it was written that "postData" should be a string of concatenated values of the request-body object, which should be created by sorting keys in "descending" order, excluding the "signature" key and encryption type should be set to "base64".
-- But in function, it is treating the body as an "object" and converting it using "toString()" then encrypting it in "hex" rather than "base64".
-- code has been fixed and PR has been raised.
var headers = {
'Content-Type': 'application/json',
'x-api-version': '2022-01-01',
'x-client-id': 'perfect id',
'x-client-secret': 'perfect secret'
};
var dataString = `{
"order_id": "o26945143520",
"order_amount": 10,
"order_currency": "INR",
"order_note": "Additional order info",
"customer_details": {
"customer_id": "ASFS12345",
"customer_email": "[email protected]",
"customer_phone": "9816512345"
}
}`;
var options = {
url: 'https://sandbox.cashfree.com/pg/orders',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
console.log(body)
}
request(options, callback);
**Output**
{"message":"Rate limiting not configured","code":"request_failed","type":"internal_error"} `
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.