Closed achirkof closed 6 years ago
Hi @ladeiko !
Thank you for your library. I'm trying to use it, but can't figure out how. I'm using Meteor based backend server and call validation in Meteor.methods like this:
Meteor.methods({ 'validateReceipt': function(appleReceipt) { var appleReceiptVerify = require('node-apple-receipt-verify'); appleReceiptVerify.config({ verbose: true, secret: 'my_secret_string', environment: ['production', 'sandbox'], ignoreExpired: true, extended: true }); appleReceiptVerify.validate({receipt: appleReceipt}, function(error, products) { if(error) { return console.log(error); } else { return console.log(products); } }); } });
but get an error:
I20180603-14:32:39.415(3)? Error: Invalid parameters I20180603-14:32:39.418(3)? at /home/smwk/develop/smartworkout-web/node_modules/node-apple-receipt-verify/lib/apple.js:505:18 I20180603-14:32:39.419(3)? at _combinedTickCallback (internal/process/next_tick.js:131:7) I20180603-14:32:39.419(3)? at process._tickDomainCallback (internal/process/next_tick.js:218:9) I20180603-14:32:39.590(3)? Result: undefined W20180603-14:32:39.597(3)? (STDERR) Unhandled rejection Error: Invalid parameters W20180603-14:32:39.599(3)? (STDERR) at /home/smwk/develop/smartworkout-web/node_modules/node-apple-receipt-verify/lib/apple.js:505:18 W20180603-14:32:39.600(3)? (STDERR) at _combinedTickCallback (internal/process/next_tick.js:131:7) W20180603-14:32:39.601(3)? (STDERR) at process._tickDomainCallback (internal/process/next_tick.js:218:9) W20180603-14:32:39.601(3)? (STDERR) From previous event: W20180603-14:32:39.602(3)? (STDERR) at Object.validate (/home/smwk/develop/smartworkout-web/node_modules/node-apple-receipt-verify/lib/apple.js:485:12) W20180603-14:32:39.603(3)? (STDERR) at Object.validate (/home/smwk/develop/smartworkout-web/node_modules/node-apple-receipt-verify/index.js:18:18) W20180603-14:32:39.604(3)? (STDERR) at MethodInvocation.validateReceipt (server/method.js:737:28) W20180603-14:32:39.604(3)? (STDERR) at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12) W20180603-14:32:39.605(3)? (STDERR) at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:1685:15) W20180603-14:32:39.606(3)? (STDERR) at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1189:12) W20180603-14:32:39.606(3)? (STDERR) at resolve (packages/ddp-server/livedata_server.js:1683:36) W20180603-14:32:39.607(3)? (STDERR) at new Promise (<anonymous>) W20180603-14:32:39.608(3)? (STDERR) at Server.applyAsync (packages/ddp-server/livedata_server.js:1682:12) W20180603-14:32:39.608(3)? (STDERR) at Server.apply (packages/ddp-server/livedata_server.js:1621:26) W20180603-14:32:39.609(3)? (STDERR) at Server.call (packages/ddp-server/livedata_server.js:1603:17) W20180603-14:32:39.610(3)? (STDERR) at Object.action (server/restAPI.js:429:20) W20180603-14:32:39.610(3)? (STDERR) at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:150:32) W20180603-14:32:39.611(3)? (STDERR) at packages/nimble_restivus/lib/route.coffee:59:33 W20180603-14:32:39.612(3)? (STDERR) at packages/simple_json-routes.js:98:9
Could you please help me? Thanks.
Ok. I understand why error is appear. Because of receipt was in JSON format instead of string.
Hi @ladeiko !
Thank you for your library. I'm trying to use it, but can't figure out how. I'm using Meteor based backend server and call validation in Meteor.methods like this:
but get an error:
Could you please help me? Thanks.