Skip to content
This repository was archived by the owner on Oct 20, 2020. It is now read-only.

Commit a03aed4

Browse files
committed
Add the transactionDetails autoRenewing flag
Apparently used for checking if subscription is cancelled
1 parent 82dcc5f commit a03aed4

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ Testing with static responses is limited, because you are only able to test the
182182

183183
**Important**: You can only test on a physical Android device, not from an emulator.
184184

185+
## Handle Canceled Subscriptions
186+
187+
Call `InAppBilling.getSubscriptionTransactionDetails(productId)` and check the `details.autoRenewing` flag. It will be set to `false` once subscription gets cancelled. Also notice, that you will need to call periodically `InAppBilling.loadOwnedPurchasesFromGoogle()` method in order to update purchase/subscription information from the Google-servers.
188+
185189
## Javascript API
186190

187191
All methods returns a `Promise`.
@@ -224,6 +228,7 @@ InAppBilling.open()
224228
- **purchaseState:** String ("PurchasedSuccessfully", "Canceled", "Refunded", "SubscriptionExpired")
225229
- **receiptSignature:** String
226230
- **receiptData:** String
231+
- **autoRenewing** Boolean
227232
- **developerPayload:** String
228233

229234
```javascript
@@ -263,6 +268,7 @@ InAppBilling.consumePurchase('your.inapp.productid').then(...);
263268
- **purchaseState:** String ("PurchasedSuccessfully", "Canceled", "Refunded", "SubscriptionExpired")
264269
- **receiptSignature:** String
265270
- **receiptData:** String
271+
- **autoRenewing** Boolean
266272
- **developerPayload:** String
267273

268274
```javascript
@@ -303,6 +309,7 @@ InAppBilling.isSubscribed('your.inapp.productid').then(...);
303309
- **purchaseState:** String ("PurchasedSuccessfully", "Canceled", "Refunded", "SubscriptionExpired")
304310
- **receiptSignature:** String
305311
- **receiptData:** String
312+
- **autoRenewing** Boolean
306313
- **developerPayload:** String
307314

308315
```javascript
@@ -467,6 +474,7 @@ InAppBilling.getSubscriptionDetailsArray(['your.inapp.productid', 'your.inapp.pr
467474
- **purchaseState:** String ("PurchasedSuccessfully", "Canceled", "Refunded", "SubscriptionExpired")
468475
- **receiptSignature:** String
469476
- **receiptData:** String
477+
- **autoRenewing** Boolean
470478
- **developerPayload:** String
471479

472480
```javascript
@@ -493,6 +501,7 @@ InAppBilling.getPurchaseTransactionDetails("your.inapp.productid").then(
493501
- **purchaseState:** String ("PurchasedSuccessfully", "Canceled", "Refunded", "SubscriptionExpired")
494502
- **receiptSignature:** String
495503
- **receiptData:** String
504+
- **autoRenewing** Boolean
496505
- **developerPayload:** String
497506

498507
```javascript

android/src/main/java/com/idehub/Billing/InAppBillingBridge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ private WritableMap mapTransactionDetails(TransactionDetails details) {
414414
? "" : purchaseData.purchaseTime.toString());
415415
map.putString("purchaseState", purchaseData.purchaseState == null
416416
? "" : purchaseData.purchaseState.toString());
417-
417+
map.putBoolean("autoRenewing", purchaseData.autoRenewing);
418418

419419
if (purchaseData.developerPayload != null)
420420
map.putString("developerPayload", purchaseData.developerPayload);

types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface ITransactionDetails {
1515
purchaseState: PurchaseState;
1616
receiptSignature: string;
1717
receiptData: string;
18+
autoRenewing: boolean;
1819
developerPayload: string;
1920
}
2021

0 commit comments

Comments
 (0)