Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 9, 2022

This PR contains the following updates:

Package Change Age Confidence
cordova-plugin-purchase 11.0.0 -> 13.12.1 age confidence

Release Notes

j3k0/cordova-plugin-purchase (cordova-plugin-purchase)

v13.12.1

Compare Source

(googleplay) Fix #​1434 - validProducts.find is not a product

Some users had this occasional error:

Error: TypeError: validProducts.find is not a function
    at http://localhost/:9909:64
    at Array.map (<anonymous>)
    at iabLoaded (http://localhost/:9908:46)
    at Object.callbackFromNative (http://localhost/:1708:52)
    at <anonymous>:1:9

This happened when another call to the native side was made before the list of products was returned (race condition kind of bug). It's fixed in that release.

v13.12.0

Compare Source

(googleplay) Upgrade to Google Play Billing library 7.1.1
  • Improved thread safety related to connection status and management.
  • Added new testing response codes to BillingResult

https://developer.android.com/google/play/billing/release-notes

(all) Fix issue with large number of transactions

In particular, when calling "restorePurchases" in Apple and the user has more than 100 transactions.

  • 5e2ad5b Delay processing of updated receipts
  • 71a071c Do not retrigger "approved" for a given transaction until a minute has elapsed
(appstore) Fix issue with event handling when autoFinish is set

Issue #​1526, approved never fires after initiating the purchase when autoFinish was set.

(all) Fix receipt without a transaction

Issue #​1526

Minor changes

Logs and documentation

v13.11.1

Compare Source

Fix running from browser with Capacitor

Add Utils.platformId() helper function to get rid of an error when running a Capacitor app in a browser.

Ref issue #​1566

v13.11.0

Compare Source

Upgrade to Google Play Billing library 7.0.0

It's a backward compatible update, main visible change is the ProrationMode being renamed ReplacementMode (but the plugin kept the old enum and fields for compatibility).

v13.10.4

Compare Source

Fix build issue on android

Java compiler started complaining about an implicit parameter. This patch fixes it.

Ref issue #​1564

v13.10.3

Compare Source

Fix issue when a callback is null or undefined

Ref issue #​1557

v13.10.1

Compare Source

Fix store.initialize() when passed a single value

store.initialize() was supposed to work when passed a single value instead of an array. It turns out there was a regression, fixed with this release.

Add store.when().initiated(transaction)

Allows monitoring INITIATED (new) transactions.

store.when().initiated(transaction => {
  // a new transaction has been initiated.
});

v13.10.0

Compare Source

(googleplay) Add "isConsumed" to consumed transactions

Local Google Play transaction now contain isConsumed, which is the same as isAcknowledged, but only set for consumable products.

Make it easier to debug callback calls

It's now possible to add a name to callbacks registered with "store.when()"

When callbacks are triggered, the reason is logged to the console.

Prevent instanciating CdvPurchase.store twice

So when ionic packages the plugin with the app code, no double instantiations of the plugin is performed.

v13.9.0

Compare Source

(appstore) store.restorePurchases() return potential errors

The return value for store.restorePurchases() has been changed from Promise<void> to Promise<IError|undefined>.

You can now inspect the value returned to figure out if processing complete with or without errors.

(appstore) Fix forceReceiptReload

In certain conditions (calls to order and restorePurchases), the AppStore adapter wants to force a refresh of the application receipt. This fix prevents it from returning the version cached in memory.

v13.8.6

Compare Source

Add CdvPurchase.Utils.platformName()

Convert CdvPurchase.Platform enum values to a more user friendly version.

Usage:

console.log(CdvPurchase.Utils.platformName(myTransaction.platform));

// returns "App Store" or "Google Play" or "Braintree", ....
Increase expiry monitor's grace period on Google Play

The 10 seconds wait before refreshing an expired subscription on Google Play wasn't enough: increased to 30 seconds.

Ref #​1468

v13.8.5

Compare Source

Fixes for Apple AppStore's introductory periods and
subscription renewals.

Load products and receipts in parallel on Apple

This solves the issue with processing the eligibility of
introductory periods.

Increase grace period for Apple subscription before refresh

After observing that Apple sometime needs more than a
minute before the API returns the subscription renewal
transaction, we increased the local grace period (time
before refresh) to 90 seconds.

CdvPurchase.Internal.ExpiryMonitor.GRACE_PERIOD_MS[Platform.APPLE_APPSTORE] = 90000;

v13.8.4

Compare Source

Trim product titles on Google Play

Google Play returns the app name in parenthesis in product titles. The plugin
now automatically trims it from the app name.

This behavior can be disabled by setting:

CdvPurchase.GooglePlay.Adapter.trimProductTitles = false
Automatically re-validate just-expired subscriptions

The plugin will now monitor active subscripion purchases (as returned by a
receipt validation service) and re-validate the receipt automatically when the
subscription expires or renews.

You can customize the expiry monitor (which should rarely be needed):

// interval between checks in milliseconds
CdvPurchase.Internal.ExpiryMonitor.INTERVAL_MS = 10000; // default: 10s

// extra time before a subscription is considered expired (when re-validating
// too early, sometime the new transaction isn't available yet).
CdvPurchase.Internal.ExpiryMonitor.GRACE_PERIOD_MS = 10000; // default: 10s
Add expiry date to Test Adapter's subscription

The expiry date was missing from the test product:

CdvPurchase.Test.testProducts.PAID_SUBSCRIPTION

v13.8.3

Compare Source

Fix npm package.

v13.8.2

Compare Source

store.applicationUsername can return undefined

If no user is logged in, you applicationUsername function can return
undefined.

Add "productId" and "platform" to Error objects

All errors now include the "platform" and "productId" field (when applicable),
to get more context.

v13.8.0

Compare Source

Upgrade to Google Play Billing library 5.2.1

Adds access to offer and base plan identifiers.

Handle validator answer with code VALIDATOR_SUBSCRIPTION_EXPIRED

For backward compatibility, the validator also support responses with a 6778003
error code (expired) when the validated transaction is expired.

Fix: AppStore adapter should only return a localReceipt on iOS

A dummy appstore receipt was listed on other platforms, this is fixed.

Prevent various issues

Prevent double calls to approved callbacks

Make sure .approved() is only called once during a small time frame.

Skip quick successive calls to store.update()

The update will be performed only if store.update() or store.initialize()
was called less than store.minTimeBetweenUpdates milliseconds.

This make it safer to always call store.update() when entering the app's
Store screen.

Block double callback registrations

Throw an error when attempting the re-register an existing callback for a given
event handler. This is indicative of initialization code being run more than
once.

v13.7.0

Compare Source

Fix AppStore introctory prices

Fix a regression with introctory prices on iOS. Unclear when this happened,
according to Apple documentation, the "discounts" array should contain the
introctory prices, but it turns out it does not anymore.

Set ES6 as minimal javascript version

Down from ES2015, for broader compatibility.

Ensure verify() resolves even if there's no validator

Some user do not specify a receipt validator but want to call
"transaction.verify()" (for example app building frameworks).

This changes makes sure the behavior gets back like it used to be in earlier
versions of the plugin.

v13.6.0

Compare Source

Add store.when().receiptsReady(cb)

The "receiptsReady" event is triggered only once, as soon as all platforms are
done loading the receipts from the SDK.

It can be used by applications that do not rely on receipt validation, in order
to wait for the list of purchases reported by the native SDK to have been
processed. For example, before running some code that check products ownership
statuses at startup.

// at startup
CdvPurchase.store.when().receiptsReady(() => {
  console.log('All platforms have loaded their local receipts');
  console.log('Feature X: ' + CdvPurchase.store.get('unlock-feature-x').owned);
});

If the receipts have already been loaded before you setup this event handler,
it will be called immediately.

Users using a receipt validation server should rely on receiptsVerified()
instead (see below).

Add store.when().receiptsVerified(cb)

Similarly to "receiptsReady", "receiptsVerified" is triggered only once: after
all platforms have loaded their receipts and those have been verified by the
receipt validation server.

It can be used by applications that DO rely on receipt validation, in order to
wait for all receipts to have been processed by the receipt validation service.
A good use case is to encapsulate startup code that check products ownership
status.

// at startup
CdvPurchase.store.when().receiptsVerified(() => {
  console.log('Receipts have been validated');
  if (CdvPurchase.store.get('monthly').owned) {
    openMainScreen();
  }
  else {
    openSubscriptionScreen();
  }
});

If the receipts have already been verified before you setup this event handler,
it will be called immediately.

Add store.when().pending(cb)

This event handler can be notified when a transaction enters the "PENDING"
state, which happens when a user has "Ask to Buy" enabled, or in country where
cash payment is an option.

store.when().pending(transaction => {
  // Transaction is pending (waiting for parent approval, cash payment, ...)
});
Remove autogrouping of products

Starting at version 13.4.0, products were automatically added to the "default"
group. This created more issues than it solved, because it let the plugin
automatically try to replace potentially unrelated products.

People willing to rely on automatic subscription replacement on Android should
explicitely set those product's group property when registering them. Or
should use the oldPurchaseToken property when making an order.

Examples:

// Replace an old purchase when finalizing the new one on google play.
store.order(product, {
  googlePlay: {
    oldPurchaseToken: 'abcdefghijkl',
    prorationMode: CdvPurchase.GooglePlay.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE,
  }
});

// For those 2 subscription products, the plugin will automatically replace
// the currently owned one (if any) when placing a new order.
store.register([{
  id: 'no_ads_yearly',
  type: ProductType.PAID_SUBSCRIPTION,
  platform: Platform.GOOGLE_PLAY,
  group: 'noAds'
}, {
  id: 'no_ads_monthly',
  type: ProductType.PAID_SUBSCRIPTION,
  platform: Platform.GOOGLE_PLAY,
  group: 'noAds'
}]);

v13.5.0

Compare Source

By default, the plugin will now setup a 20 seconds timeout for receipt validation requests.

Receipt validation timeout can be detected using the following code:

CdvPurchase.store.when().unverified(function(response) {
  if (response.payload.code === CdvPurchase.ErrorCode.COMMUNICATION) {
    if (response.payload.status === CdvPurchase.Utils.Ajax.HTTP_REQUEST_TIMEOUT) {
      // request timeout
    }
  }
});

The value for timeout can be customized by specifying the validator this way:

CdvPurchase.store.validator = {
  url: 'https://validator.iaptic.com',
  timeout: 30000, // in milliseconds
}

v13.4.3

Compare Source

Let the app know the HTTP status for a failed receipt validation call, in "response.payload.status".

CdvPurchase.store.when().unverified(response => {
    if (response.payload.code === CdvPurchase.ErrorCode.COMMUNICATION) {
        console.log("HTTP ERROR: " + response.payload.status);
    }
});

v13.4.2

Compare Source

Attempt to fix issue #​1406 on iOS, with Ionic v6: applicationUsername isn't attached to purchase, it seems like this is due to strings passed as a subclass of NSString on this platform.

v13.4.0

Compare Source

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.11

Compare Source

v13.3.10

Compare Source

v13.3.9

Compare Source

v13.3.8

Compare Source

v13.3.7

Compare Source

v13.3.6

Compare Source

v13.3.5

Compare Source

v13.3.4

Compare Source

v13.3.3

Compare Source

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:

  1. Product is already owned (see product.owned)
  2. 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

Compare Source

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

Compare Source

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

Compare Source

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

Compare Source

v13.2.0

Compare Source

Adding store.when().unverified()

unverified will be called when receipt validation failed.

Fixing Product.pricing

Issue #​1368 fixed: product.pricing was always undefined.

v13.1.6

Compare Source

Bug hasn't been reproduced, but the fix should handle the error case that happened to this user (based on the provided logs).

v13.1.5

Compare Source

  • 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

Compare Source

  • b692e21 Don't error if finishing already finished transaction
  • 49c0508 Force receipt refresh after order() and restorePurchases()

v13.1.3

Compare Source

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

v13.1.2

Compare Source

v13.1.1

Compare Source

v13.0.3

Compare Source

v13.0.2

Compare Source

v13.0.1

Compare Source

v13.0.0

Compare Source

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.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 5 times, most recently from fddc88f to e9ce117 Compare December 19, 2022 13:21
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 3 times, most recently from 4f9daaa to 6e147e3 Compare December 22, 2022 19:40
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 8 times, most recently from b553e78 to bb4c92c Compare January 2, 2023 18:34
@renovate renovate bot changed the title ⬆️ Update dependency cordova-plugin-purchase to v13 chore(deps): Update dependency cordova-plugin-purchase to v13 Jan 6, 2023
@renovate renovate bot changed the title chore(deps): Update dependency cordova-plugin-purchase to v13 chore: Update dependency cordova-plugin-purchase to v13 Jan 7, 2023
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 3 times, most recently from 3919214 to b20be58 Compare January 19, 2023 19:23
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 4 times, most recently from 6f6b34c to 593b6cd Compare February 9, 2023 17:16
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 3 times, most recently from a6064a0 to 913ddc8 Compare February 24, 2023 17:16
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 913ddc8 to 5334cc3 Compare March 6, 2023 10:44
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 5334cc3 to 865bf7a Compare March 20, 2023 15:12
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 865bf7a to 6fd055a Compare March 25, 2023 14:34
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 6fd055a to 4b863a7 Compare April 17, 2023 18:10
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from d368b8b to 3a3933b Compare May 7, 2023 01:21
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from a8cac43 to ae97dce Compare May 22, 2023 17:52
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from 621015e to b567fa0 Compare June 1, 2023 13:52
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from b567fa0 to 3ee0829 Compare June 16, 2023 08:58
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from d09574d to d1ab6d0 Compare September 7, 2023 13:34
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 3 times, most recently from 0d4aa12 to 120d478 Compare September 27, 2023 15:55
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from 59ab3ff to ad08384 Compare October 4, 2023 15:25
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from ad08384 to e8b68db Compare November 1, 2023 14:10
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from e8b68db to 2174171 Compare November 12, 2023 12:54
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 2174171 to ba8843e Compare December 4, 2023 15:36
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from ba8843e to b39741c Compare January 4, 2024 07:47
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from b39741c to 7b4d1a3 Compare January 19, 2024 16:07
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 2 times, most recently from 967226f to fa34d62 Compare May 16, 2024 01:04
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch 3 times, most recently from f068c48 to 1de0651 Compare May 30, 2024 11:03
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 1de0651 to 1fece8e Compare December 2, 2024 10:10
@renovate renovate bot force-pushed the renovate/cordova-plugin-purchase-13.x branch from 1fece8e to a945bd7 Compare December 27, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant