voltrue2 / in-app-purchase

A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
http://iap.gracenode.org
Other
1.04k stars 287 forks source link

Support toggling Google service on/off with validateOnce #286

Open comtaler opened 4 years ago

comtaler commented 4 years ago

We are trying to integrate a new receipt verification service called Flexion. It is a portal for various stores (amazon/samsung/...), it generates receipts in the same way as Google's receipt format except that it adds an extra field in the payload to indicate that it is signed by Flexion. And it uses public key to validate the receipt the same way as Google.

I have tried different ways to use this library to work around supporting both Google service validation and Flexion at the same time. But failed to do so.

I looked into the code, since useGoogleApi is a global variable, I can't re-configure the lib every time when making a purchase since multiple receipt validations can be going at the same time.

What would be the best way to support our usage case?

ghost commented 4 years ago

Hi, I have the same problem. When i use iap.reset() the variable 'useGoogleApi' still has its old value. Would you change this?

Thanks for your time