Skip to content

Releases: j3k0/cordova-plugin-purchase

v13.0.0

07 Sep 14:03
9d8c265
Compare
Choose a tag to compare

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

16 Feb 08:48
7514fa3
Compare
Choose a tag to compare

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.

v10.6.1

16 Feb 08:48
fe46e4d
Compare
Choose a tag to compare

Bug fixes:

  • c5fdc88 (android) Fix #1223 - Product with no title
  • 0f828c6 (android) Fix issue in order() when additionalData is undefined

v10.6.0

16 Feb 08:48
c83bf46
Compare
Choose a tag to compare

Use the advanced-http plugin when installed

Receipt validation requests will use the advanced-http plugin when it is installed.

This allows to setup some extra options (like header authentication) and get rid of CORS issues.

See 68a6c3f

Bug fixes

v10.5.4

16 Feb 08:47
d33cdae
Compare
Choose a tag to compare

Add support for custom headers to validator call

store.validatorCustomHeaders can be set to an object containing keys and values of headers to be sent to the receipt validation server.

See 256a10e baae021

Minor changes

  • fb249b6 Adjust validator retry delay
    • When the request to the receipt validator fails, we now increase the retry delay to less agressive values.
  • 91489a4 (android) Query purchase on start every 24h only
    • The plugin used to query for purchases each time the app was sent to foreground.
    • No need to query more often than every 24h, to frequent calls used to causes issues (especially overlapping calls).
    • Ref #1110

Chores

  • 7be2fe6 Upgrade Google Billing Library to v3.0.3
  • eda72d7 (typescript) Integrate the documentation
  • f8bd21d (typescript) Add typings for refresh() return value

Bug fixes

v10.5.2

16 Feb 08:46
5aab884
Compare
Choose a tag to compare
  • 7e9d58b (ios) Fix #1142 - Wrong references to storekit.ERR_*

v10.5.1

16 Feb 08:45
ca656bc
Compare
Choose a tag to compare

v10.5.0

18 Nov 08:56
7a13c00
Compare
Choose a tag to compare

XCode 12 (with support for iOS 14.0 new APIs) is required to use this version of the plugin for iOS.

dd6bf6f Add store.redeem()

Redeems a promotional offer from within the app.

  • On iOS, calling store.redeem() will open the Code Redemption Sheet.
  • This call does nothing on Android and Microsoft UWP.

example usage

    store.redeem();

v10.4.0

17 Nov 08:05
26156ae
Compare
Choose a tag to compare

This release contains fixes for minor bugs and edge cases.

c579e87 Improve use of isExpired collection field

The plugin now better handles the case where the receipt validator reports a subscription as expired using the collection field, even when this happens when validating the application receipt.

In particular, with this change, the expired event will be triggered when subscription expiry is set this way.

c0fc12e (ios) Limit interactive renewals detection to 1 hour

This fixes an issue where, for some users, the receipt was ever-refreshing because the plugin though it just expired, while this happened long ago.

43eff81 (ios) Don't assume in_app array is sorted

in_app used to be sorted chronologically, it's not true anymore. It was a bad assumption anyway.

fba6605 (ios) Fix #1123 - Found nil parameter when creating SKPaymentDiscount

SKPaymentDiscount was mistakenly initiated with nil parameters, which iOS 14.1 started to complain about.

Chores

  • 9193479 Add store.applicationUsername to typescript definitions
  • c1612e6 (ios) Remove "const" from ios-adapter.js
    • Keep the plugin compatible with old javascript engines.

v10.3.0

14 Sep 06:52
d54bf64
Compare
Choose a tag to compare

(android) Upgrade to Google Play Billing Library to 3.0.0

The upgrade to the latest version of Google Play Billing Library comes with some difference, mainly in the native code, but also some new features and modified options.

Subscription proration modes

When upgrading and downgrading a subscription, you can now specify the proration mode, i.e. when and how the replacement will take place.

To support this, the plugin now accepts the prorationMode key in the additionalData passed to the store.order() function. Itis a string that describes the proration mode to apply when upgrading/downgrading a subscription with oldSku on Android. See https://developer.android.com/google/play/billing/subs#change

Possible values:

  • DEFERRED - Replacement takes effect when the old plan expires, and the new price will be charged at the same time.
  • IMMEDIATE_AND_CHARGE_PRORATED_PRICE - Replacement takes effect immediately, and the billing cycle remains the same.
  • IMMEDIATE_WITHOUT_PRORATION - Replacement takes effect immediately, and the new price will be charged on next recurrence time.
  • IMMEDIATE_WITH_TIME_PRORATION - Replacement takes effect immediately, and the remaining time will be prorated and credited to the user.

Removing developerPayload

developerPayload isn't supported anymore with Billing Library v3. See https://developer.android.com/google/play/billing/developer-payload

Update the subscription upgrade / downgrade

The new version now requires the oldPurchaseToken next to the oldSku to upgrade a subscription. This is a random string that identifies a purchase. The plugin is smart enough to figure it out for you when upgrading a subscription so there shouldn't be a reason to update your code.

However, it's now possible to force the value for this parameter (in case you have a doubt whether the running instance of your app doesn't have the latest data, this might safeguard against a unwanted upgrade).

(all) Add .failed and .cancelled to refresh() return value

Allows apps to display some UI element while the refresh() operation is in progress.

Disable retrying validator for expired subscription

This code dates from the era before Apple was returning the latest_receipt_info in the validator. There is no need to refresh the receipt anymore to make sure we have the latest info.

Bugs

  • (ios) Fix #1066 bug readonly property with WKWebView
  • (ios) #1092 Disable appStoreReceipt refresh on purchase
    • Calling refreshReceipt on iOS was triggering an unecessary password prompt, different from the fingerprint validation required by a purchase.