Skip to content

Commit

Permalink
v13.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
j3k0 committed Jun 16, 2023
1 parent 6d14dd0 commit c2d80a4
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 4 deletions.
103 changes: 103 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
# Release Notes - Cordova Plugin Purchase

## 13.6

### 13.6.0

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

```ts
// 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.

```ts
// 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.

```ts
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:**

```ts
// 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'
}]);
```

## 13.5

### 13.5.0 - Add timeout to validation requests
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-purchase",
"version": "13.5.0",
"version": "13.6.0",
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)",
"cordova": {
"id": "cordova-plugin-purchase",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-purchase"
xmlns:android="http://schemas.android.com/apk/res/android"
version="13.5.0">
version="13.6.0">

<name>Purchase</name>
<description>Cordova Purchase plugin for iOS (AppStore), Android (PlayStore) and Windows</description>
Expand Down
2 changes: 1 addition & 1 deletion src/ts/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace CdvPurchase {
/**
* Current release number of the plugin.
*/
export const PLUGIN_VERSION = '13.5.0';
export const PLUGIN_VERSION = '13.6.0';

/**
* Entry class of the plugin.
Expand Down

0 comments on commit c2d80a4

Please sign in to comment.