Comments (6)
@karthit Cannot encode value
seems like a Firebase error. this.path
is supposed to be undefined
within the constructor ... only when you use a method on an instance (pg/payouts), its value gets set.
Could you share logs? Which method are you using and how are you invoking it?
from cashfree-sdk-nodejs.
const pg = new PaymentGateway(pgConfig); //path: undefined
await pg.refunds.initiateRefund({req.body});
since the value of path: undefined, instead of null or any default value, in Firebase cloud function this undefined value is creating this error message: Cannot encode value
from cashfree-sdk-nodejs.
If you are literally doing this then it's wrong – what you are passing is an invalid object.
await pg.refunds.initiateRefund({req.body});
Below works for me:
const pgInstance = new PaymentGateway({
env: 'TEST',
apiVersion: '<API_VERSION>',
appId: '<YOUR_APP_ID>',
secretKey: '<YOUR_SECRET_KEY>',
});
const body = {
orderId: 'ORDER123',
referenceId: '13307',
refundAmount: '102.00',
refundNote: 'Sample Refund note',
refundType: '',
refundType: '',
mode: '',
accountNo: '',
ifsc: '',
};
const response = await pgInstance.refunds.initiateRefund(body);
console.log(response);
Also, path
is not an issue. It's getting set as /api/v1/order/refund
later when you call .initiateRefund()
.
from cashfree-sdk-nodejs.
yes we are using same above lines of code, but while working with Firebase cloud functions the PaymentGateWay constructor returns undefined path, we are getting Cannot encode value error, it works with express but the issue is with only when deployed Firebase cloud functions.
Even though we set the path to different methods after this, Firebase cloud failed while returning this
const pgInstance = new PaymentGateway({
env: 'TEST',
apiVersion: '<API_VERSION>',
appId: '<YOUR_APP_ID>',
secretKey: '<YOUR_SECRET_KEY>',
});
pgInstance object { ..., path: undefined }
we expect this should be having some valid default values, like { ...., path: null } then Firebase cloud function can work with the null values returned in the object pgInstance, but not the undefined.
from cashfree-sdk-nodejs.
@karthit Why don't you try forking the repository and set a default value of path
in the constructor as "" to see whether it works for you or not?
from cashfree-sdk-nodejs.
@karthit SDK has been updated. It will work now.
from cashfree-sdk-nodejs.
Related Issues (9)
- Encode URI components properly HOT 1
- Getting cannot read property token when IP is not whitelisted HOT 1
- TypeError: Cannot read property 'token' of undefined HOT 2
- not able to use Trigger Payment Email api!
- Rate limiting not configured HOT 2
- Rate limiting not configured | Issue not solved please provide link to solution HOT 4
- "verifySignature" function not working in lib/payouts/services.
- Add typescript typings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cashfree-sdk-nodejs.