voltrue2/in-app-purchase

missing package name (google play)

fitmax-project opened this issue · 3 comments

hey.
i am trying to validate iap for subscription product on google play.
but i am getting Error: Missing Package Name
my edited recipe look like that:

const editedRes = JSON.parse('' + transactionReceipt + '');

    const googleOrder = {
      packageName: editedRes.packageName,
      productId: editedRes.productId,
      purchaseToken: editedRes.purchaseToken,
      subscription: true // if the receipt is a subscription, then true
    };
    const recipt = {
      data: googleOrder,
      signature:
        '<my-google-play-Licensing-&-in-app-billing>'
    };

my iap settings:


  googleServiceAccount: {
    clientEmail:
      'xxxxxxxxxxxxxxxxxx,
    privateKey:
      'xxxxxxxxxxxxxxxxxx'
  },

  /* Configurations for Google Play */
  googlePublicKeyStrSandBox:  'xxxxxxxxxxxxxxxxxx, // this is the google iap-sandbox public key string
  googlePublicKeyStrLive: 'xxxxxxxxxxxxxxxxxx', // this is the google iap-live public key string
  googleAccToken:  'xxxxxxxxxxxxxxxxxx, // optional, for Google Play subscriptions
  googleRefToken: 'xxxxxxxxxxxxxxxxxx', // optional, for Google Play subscritions
  googleClientID: 'xxxxxx, // optional, for Google Play subscriptions
  googleClientSecret: 'xxxxxx', // optional, for Google Play subscriptions
  verbose: true,
  test: true

means - all is set...

any idea what could go wrong??

btw - signature prop and googlePublicKeyStrLive are same, isnt?
p.s apple works great

Hey @fitmax-project!

Same here, did you able to find a solution?

I called validate app like this:

data = <JSON> 

iap.validate({
  data: receipt,
  signature
})

and i got the same error:
{"error":{},"status":1,"message":"Missing Package Name"}

After looking through the code of the module i found that the validate function should be called a bit differently:

receipt.signature = signature;
iap.validate(receipt)

It looks like that it's using different parameters if the googleServiceAccount is provided in config

Can you please let me know where you were able to get the following info:

googleServiceAccount: {
clientEmail:
'xxxxxxxxxxxxxxxxxx,
privateKey:
'xxxxxxxxxxxxxxxxxx'
},

Where is the google Service account located!?

/* Configurations for Google Play */
googlePublicKeyStrSandBox: 'xxxxxxxxxxxxxxxxxx, // this is the google iap-sandbox public key string
googlePublicKeyStrLive: 'xxxxxxxxxxxxxxxxxx', // this is the google iap-live public key string

I am able to get the STRLive from play console, where can i get the sandbox?!