Optional
applicationReturn the identifier of the user for your application
Logger
Avoid invoking store.update() if the most recent call occurred within this specific number of milliseconds.
URL or implementation of the receipt validation service
Define the validator as a string
CdvPurchase.store.validator = "https://validator.iaptic.com/v1/validate?appName=test"
Define the validator as a function
CdvPurchase.store.validator = (receipt, callback) => {
callback({
ok: true,
data: {
// see CdvPurchase.Validator.Response.Payload for details
}
})
}
When adding information to receipt validation requests, those can serve different functions:
Make sure the value your select is in line with your application's privacy policy and your users' tracking preference.
CdvPurchase.store.validator_privacy_policy = [
'fraud', 'support', 'analytics', 'tracking'
]
Verbosity level used by the plugin logger
Set to:
Version of the plugin currently installed.
true if the plugin is initialized and ready
List of all receipts present on the device.
List of all transaction from the local receipts.
List of all purchases from the verified receipts.
List of receipts verified with the receipt validation service.
Those receipt contains more information and are generally more up-to-date than the local ones.
Returns true if a platform supports the requested functionality.
store.checkSupport(Platform.APPLE_APPSTORE, 'requestPayment');
// => false
Find the latest transaction for a given product, from those reported by the device.
Find the last verified purchase for a given product, from those verified by the receipt validator.
Find a product from its id and platform
Product identifier on the platform.
Optional
platform: PlatformThe product the product exists in. Can be omitted if you're only using a single payment platform.
Retrieve a platform adapter.
The platform adapter has to have been initialized before.
Get the application username as a string by either calling or returning Store.applicationUsername
Call to initialize the in-app purchase plugin.
List of payment platforms to initialize, default to Store.defaultPlatform().
Opens the billing methods page on AppStore, Play, Microsoft, ...
From this page, the user can update their payment methods.
If platform is not specified, the first available platform will be used.
Optional
platform: Platformif (purchase.isBillingRetryPeriod)
store.manageBilling(purchase.platform);
Open the subscription management interface for the selected platform.
If platform is not specified, the first available platform will be used.
Optional
platform: Platformconst activeSubscription: Purchase = // ...
store.manageSubscriptions(activeSubscription.platform);
Setup a function to be notified of changes to a transaction state.
The transaction to monitor.
Function to be called when the transaction status changes.
A monitor which can be stopped with monitor.stop()
const monitor = store.monitor(transaction, state => {
console.log('new state: ' + state);
if (state === TransactionState.FINISHED)
monitor.stop();
});
Remove a callback from any listener it might have been added to.
Place an order for a given offer.
Optional
additionalData: CdvPurchase.AdditionalDataReturn true if a product is owned
The product object or identifier of the product.
Register a callback to be called when the plugin is ready.
This happens when all the platforms are initialized and their products loaded.
Register a product.
store.register([{
id: 'subscription1',
type: ProductType.PAID_SUBSCRIPTION,
platform: Platform.APPLE_APPSTORE,
}, {
id: 'subscription1',
type: ProductType.PAID_SUBSCRIPTION,
platform: Platform.GOOGLE_PLAY,
}, {
id: 'consumable1',
type: ProductType.CONSUMABLE,
platform: Platform.BRAINTREE,
}]);
Request a payment.
A payment is a custom amount to charge the user. Make sure the selected payment platform supports Payment Requests.
Parameters of the payment request
Optional
additionalData: CdvPurchase.AdditionalDataAdditional parameters
Entry class of the plugin.