Releases: j3k0/cordova-plugin-purchase
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)
v13.1.4
v13.1.3
Fixing some receipt validation use cases on Apple devices.
- 9cfce2d Load missing iOS appStoreReceipt when validation call is requested
- 2569147 Update validator functions to include the receipts
- f03a751 Refresh appStoreReceipt if empty at validation stage
Update to requestPayment()
In the payment request, the items
array now replace the productIds
array. Use this array to define the list of items the user is paying for. For example:
CdvPurchase.store.requestPayment({
platform: CdvPurchase.Platform.BRAINTREE,
amountMicros: 11000000,
currency: 'USD',
items: [{
id: 'margherita_large',
title: 'Pizza Margherita Large',
pricing: {
priceMicros: 10000000,
}
}, {
id: 'delivery_standard',
title: 'Delivery',
pricing: {
priceMicros: 1000000,
}
}]
});
The format for items makes them compatible with products loaded from the stores. You can then manage your inventory on Google Play but allow payment for those Google Play products using Braintree:
store.register([{
id: 'five_tokens',
type: ProductType.CONSUMABLE
platform: Platform.GOOGLE_PLAY,
}]);
// Later on...
store.requestPayment({
platform: CdvPurchase.Platform.BRAINTREE,
amountMicros: 11000000,
currency: 'USD',
items: [store.get('five_tokens')],
});
See PaymentRequest and PaymentRequestItem for details.
Fixes for Braintree.requestPayment()
Bug fixes:
- Properly using the provided
applePayOptions
- Detecting payment request cancellations by user
requestPayment() amount computed from items
If the amount is not provided in a payment request, it will be computed as the sum of all items.
Currency will also be retrieved from the items when missing.
v13.0.0
This is a full rewrite of the API, updated to allow:
- using multiple payment processors in parallel
- exposing multiple offers for a single product and complex pricing
- exposing purchases from receipts (either local receipts or verified from a server)
- placing custom payment requests
All JavaScript code has being rewritten in TypeScript, typings are now 100% complete and accurate.
If you're upgrading from an earlier version, check the migration guide.
The native code is built using version 12 as starting point, so all features from version 12 are available as well.
Braintree
This version introduces support for Braintree as a payment processor, it requires an additional plugin to add the libraries to your project: https://github.com/j3k0/cordova-plugin-purchase-braintree
The Braintree integration supports payment with 3DSecure and Apple Pay.
Windows Store
Support for payments on Windows Store has been dropped. It will be back in a later version.
Overview
The new API separates the different concepts with their own first-level entities:
- Products
- Offers
- Receipts
- Transactions
Products / Offers will contain the definition of what's available to the user to purchase.
Receipts / Transactions will contain details about what the user has purchased.
In the new API, it is possible to initiate transactions not necessarily linked with a product (using payment processors like Braintree).
It defines a generic Adapter interface, implemented by the various payment platforms. The core of the plugin controls and monitors the different active adapters and expose the unified API. Previously, we basically had an iOS implementation of the unified API (using StoreKit), an android implementation, etc... Now, many adapters can coexist in peace.
v11.0.0
Upgrade to Google Play Billing library v4.0
With the upgrade to the Billing Library v4, the main change was the way subscriptions are upgraded / downgraded. However, as this plugin offers a more high level interface, we were able to implement this migration in a non breaking way.
There are 2 noticeable additions to the API:
store.launchPriceChangeConfirmationFlow(productId, callback)
Android only: display a generic dialog notifying the user of a subscription price change.
See https://developer.android.com/google/play/billing/subscriptions#price-change-communicate
- This call does nothing on iOS and Microsoft UWP.
example usage
store.launchPriceChangeConfirmationFlow("my_product_id", function(status) {
if (status === "OK") { /* approved */ }
if (status === "UserCanceled") { /* dialog canceled by user */ }
if (status === "UnknownProduct") { /* trying to update price of an unregistered product */ }
}));
"IMMEDIATE_AND_CHARGE_FULL_PRICE"
proration mode
The proration mode is passed to store.order()
, in the additionalData.prorationMode
field.
If IMMEDIATE_AND_CHARGE_FULL_PRICE
proration mode is used when upgrading / downgrading a subscription, the replacement takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan.