Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Instance #325

Open
Spar9a opened this issue Aug 12, 2020 · 0 comments
Open

Multiple Instance #325

Spar9a opened this issue Aug 12, 2020 · 0 comments

Comments

@Spar9a
Copy link

Spar9a commented Aug 12, 2020

Can't create multiple instance of iap object with different service account.

Example of my code:

function iapInit(clientEmail, privateKey, fastify) {
  console.log("EVENT: Start IAP-Plugin initialization");
  fastify.iap_appq = require("in-app-purchase");
  const testEnv = process.env.TEST === "true";
  const verboseEnv = process.env.VERBOSE === "true";
  fastify.iap_appq.config({
    /* Configurations for Apple */
    appleExcludeOldTransactions: process.env.APPLE_EXCLUDE_OLD_TRANSACTIONS, // if you want to exclude old transaction, set this to true. Default is false

    /* Configurations for Google Play */
    // googlePublicKeyPath: 'path/to/public/key/directory/', // this is the path to the directory containing iap-sandbox/iap-live files
    //googlePublicKeyStrSandBox: GOOGLE_API_KEY, // this is the google iap-sandbox public key string
    //googlePublicKeyStrLive: googleKey, // this is the google iap-live public key string
    googleServiceAccount: {
      clientEmail: clientEmail,
      privateKey: privateKey,
    },

    /* Configurations all platforms */
    test: false, // For Apple and Google Play to force Sandbox validation only
    verbose: true, // Output debug logs to stdout stream
  });

  fastify.iap_appq.setup();
  console.log("EVENT: IAP-Plugin initialized");
  return fastify;
}

After initialization all objects links to one service account, that was initialized first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant