deepalimittalgit / clover_ecomm_app

Sample App for Clover Ecomm using Clover's Node SDK
4 stars 2 forks source link

Error: Invalid JSON received from the Clover API #1

Open Wingjam opened 4 years ago

Wingjam commented 4 years ago

Hi,

First, thanks for your sample app!

I just cloned your repo, add the .env file with the right information and roll it all up. When testing "Pay with iFrame SDK" with a test card, I got "Invalid JSON received from the Clover API" error. Did I do something wrong?

image

Full error output :

[0] Getting error in Charge API -  { Error: Invalid JSON received from the Clover API
[0]     at IncomingMessage.res.once (path/to/repo/clover_ecomm_app-master/node_modules/clover-ecomm-sdk/lib/net/Resources.js:150:15)
[0]     at Object.onceWrapper (events.js:286:20)
[0]     at IncomingMessage.emit (events.js:203:15)
[0]     at endReadableNT (_stream_readable.js:1145:12)
[0]     at process._tickCallback (internal/process/next_tick.js:63:19)
[0]   raw:
[0]    { message: 'Invalid JSON received from the Clover API',
[0]      response: { message: [Object], error: [Object] },
[0]      exception:
[0]       ReferenceError: GenericError is not defined
[0]           at Function.generate (path/to/repo/clover_ecomm_app-master/node_modules/clover-ecomm-sdk/lib/Error.js:57:9)
[0]           at IncomingMessage.res.once (path/to/repo/clover_ecomm_app-master/node_modules/clover-ecomm-sdk/lib/net/Resources.js:143:39)
[0]           at Object.onceWrapper (events.js:286:20)
[0]           at IncomingMessage.emit (events.js:203:15)
[0]           at endReadableNT (_stream_readable.js:1145:12)
[0]           at process._tickCallback (internal/process/next_tick.js:63:19),
[0]      requestId: undefined },
[0]   rawType: undefined,
[0]   code: undefined,
[0]   param: undefined,
[0]   detail: undefined,
[0]   headers: undefined,
[0]   requestId: undefined,
[0]   statusCode: undefined }
dkwan8888 commented 4 years ago

If API responses are correct, JSON should be able to parse them correctly. Use your .env in https://docs.clover.com/clover-platform/reference/charges

To test and see whats the response.

deepalimittalgit commented 4 years ago

Hi Wing, Thanks for reaching out. I tried with my sample sandbox credentials and I am able to charge successfully. You can share your charge request to me DM- deepali.mittal@clover.com , I will try if anything wrong with request. You would need to provide API Token in Charge Request, which should have beeen part of your .env file.

Screen Shot 2020-05-13 at 12 45 06 PM Screen Shot 2020-05-13 at 12 44 58 PM