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.
Can't create multiple instance of iap object with different service account.
Example of my code:
After initialization all objects links to one service account, that was initialized first.