Releases: j3k0/cordova-plugin-purchase
v13.4.0
Product groups and Google Play
Products are now part of the "default"
group when none is provided, as per the documentation. This is used on Google Play to automatically replace existing subscription by the newly ordered one.
This update can break your app if you have multiple independent subscription products on Google Play, as purchasing a subscription product will now cancel any existing one by default.
Use the group
property in store.register
to force legacy subscription products to be part of different groups.
v13.3.3
Use canMakePayments on Apple AppStore
offer.canPurchase
will be false if the platform reports that it doesn't support the "order" functionality.
When you check if the offer can be purchased, the plugin will now use the value from canMakePurchases
(for Apple AppStore).
if (!offer.canPurchase) {
// the given offer cannot be purchased. hide it or hide the buy button.
}
If none of the offers can be purchased, you can choose to hide the whole store.
There are 2 reasons why an offer cannot be purchased:
- Product is already owned (see
product.owned
) - The adapter don't support "order()"
If you really want to access the low-level value of canMakePurchases
you can do it like so:
const appStore = store.getAdapter(CdvPurchase.Platform.APPLE_APPSTORE);
if (appStore && appStore.checkSupport('order')) {
// user can make payments
}
Ref #1378
v13.3.2
Add support for promotional offers on Apple AppStore
You can order a discount offer by providing additional data to "offer.order()" like so:
offer.order({
appStore: {
discount: {
id: "discount-id",
key: "...",
nonce: "...",
signature: "...",
timestamp: "...",
}
}
});
Check Apple documentation about the meaning of those fields and how to fill them. https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/subscriptions_and_offers/setting_up_promotional_offers?language=objc
You can check this old example server here: https://github.com/j3k0/nodejs-suboffer-signature-server
v13.3.1
Fix "store.order" promise resolution
Wait for the transaction to be purchased or the purchase cancelled before resolving.
Example usage:
store.order(offer)
.then((result) => {
if (result && result.isError) {
if (result.code === CdvPurchase.ErrorCode.PAYMENT_CANCELLED) {
// Payment cancelled: window closed by user
}
else {
// Payment failed: check result.message
}
}
else {
// Success
}
});
v13.3.0
Add the AppStore autoFinish
option
Use this if the transaction queue is filled with unwanted transactions (in development).
It's safe to keep this option to "true" when using a receipt validation server and you only sell subscriptions
Example:
store.initialize([
{
platform: Platform.APPLE_APPSTORE,
options: { autoFinish: true }
},
Platform.GOOGLE_PLAY
]);
Optimize AppStore receipt loaded multiple times in parallel
When the Apple appStoreReceipt
is loaded from multiple source, it resulted in a lot of duplicate calls. 13.3.0 optimizes this use case.
Add transactionId and purchaseId to VerifiedPurchase
It's just a TypeScript definition since the plugin doesn't do much with it, but it has been requested by a few users.
v13.2.1
v13.2.0
v13.1.6
v13.1.5
AppStore fixes
- 51400ab Adding in-progress transaction to a pseudo receipt
- c0e47b3 Reloading receipt from native side before receipt validation
- 5a8542b Improved error reporting
- 7a80a6d Do not call "finished" for failed transactions
- 348431e Report success/failure of purchase
- e53017c Fix crash when logged out of iCloud (#1354)