@capgo/native-purchases 8.8.1 → 8.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -5
- package/android/build.gradle +3 -1
- package/android/src/main/java/ee/forgr/nativepurchases/NativePurchasesLog.java +69 -0
- package/android/src/main/java/ee/forgr/nativepurchases/NativePurchasesPlugin.java +449 -287
- package/android/src/main/java/ee/forgr/nativepurchases/ProductPayloadMapper.java +6 -0
- package/dist/docs.json +148 -3
- package/dist/esm/definitions.d.ts +105 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +9 -0
- package/dist/esm/web.js +11 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +9 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +9 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NativePurchasesPlugin/NativePurchasesLog.swift +39 -0
- package/ios/Sources/NativePurchasesPlugin/NativePurchasesPlugin+PurchaseHandling.swift +4 -3
- package/ios/Sources/NativePurchasesPlugin/NativePurchasesPlugin+TransactionFinishing.swift +108 -0
- package/ios/Sources/NativePurchasesPlugin/NativePurchasesPlugin.swift +80 -53
- package/ios/Sources/NativePurchasesPlugin/Product+CapacitorPurchasesPlugin.swift +15 -0
- package/ios/Sources/NativePurchasesPlugin/TransactionHelpers.swift +15 -0
- package/ios/Tests/NativePurchasesPluginTests/IntroEligibilityMapperTests.swift +17 -0
- package/ios/Tests/NativePurchasesPluginTests/NativePurchasesPluginTests.swift +4 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
# native-purchases
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Sell in-app purchases and subscriptions in your Capacitor app with StoreKit on iOS and Google Play Billing on Android, without a third-party payments service.
|
|
4
|
+
|
|
5
|
+
<a href="https://capgo.app/?ref=plugin_native_purchases"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-native-purchases" alt="Capgo - Instant updates for Capacitor" /></a>
|
|
3
6
|
|
|
4
7
|
<div align="center">
|
|
5
|
-
<
|
|
6
|
-
<h2><a href="https://capgo.app/
|
|
8
|
+
<p><b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without waiting for app store review.</p>
|
|
9
|
+
<h2><a href="https://capgo.app/register/?ref=plugin_native_purchases">➡️ Get started for free</a></h2>
|
|
10
|
+
<p>14-day unlimited free trial. No credit card required</p>
|
|
11
|
+
<p><a href="https://capgo.app/consulting/?ref=plugin_native_purchases">Missing a feature? We'll build the plugin for you 💪</a></p>
|
|
7
12
|
</div>
|
|
8
13
|
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="https://raw.githubusercontent.com/Cap-go/capacitor-native-purchases/main/assets/github-social-preview.png" alt="@capgo/native-purchases for Capacitor apps" width="300" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Key features
|
|
19
|
+
|
|
20
|
+
- **Products**: `getProducts()` and `getProduct()` return localized prices and details.
|
|
21
|
+
- **Purchases**: `purchaseProduct()` for consumables, non-consumables and subscriptions, with `acknowledgePurchase()`, plus `consumePurchase()` on Android.
|
|
22
|
+
- **Restore and history**: `restorePurchases()` and `getPurchases()`.
|
|
23
|
+
- **Subscription tools**: `manageSubscriptions()`, `presentOfferCodeRedeemSheet()` and `getStorefront()`.
|
|
24
|
+
- **Server validation**: receipt data and the `transactionUpdated` and `transactionVerificationFailed` events on iOS, purchase tokens on Android.
|
|
25
|
+
- **Platforms**: iOS and Android. Web mocks the purchase calls for development, except `consumePurchase()`, which is Android only.
|
|
26
|
+
|
|
9
27
|
## In-app Purchases Made Easy
|
|
10
28
|
|
|
11
29
|
This plugin allows you to implement in-app purchases and subscriptions in your Capacitor app using native APIs.
|
|
@@ -1318,7 +1336,7 @@ If you're coming from cordova-plugin-purchase, here's the mapping:
|
|
|
1318
1336
|
| cordova-plugin-purchase | @capgo/native-purchases | Platform | Notes |
|
|
1319
1337
|
|-------------------------|-------------------------|----------|-------|
|
|
1320
1338
|
| `transaction.transactionReceipt` | `transaction.receipt` (base64) | iOS | Legacy StoreKit receipt format (same value as Cordova) |
|
|
1321
|
-
|
|
|
1339
|
+
| - | `transaction.jwsRepresentation` (JWS) | iOS | StoreKit 2 JWS format (iOS 15+, additional field with no Cordova equivalent; Apple's recommended modern format for new implementations) |
|
|
1322
1340
|
| `transaction.purchaseToken` | `transaction.purchaseToken` | Android | Same field name |
|
|
1323
1341
|
|
|
1324
1342
|
**This plugin already exposes everything you need for backend verification!** The `receipt` and `purchaseToken` fields contain the complete verified receipt data, and `jwsRepresentation` provides an additional StoreKit 2 representation when available.
|
|
@@ -1702,10 +1720,32 @@ Comments on best practices:
|
|
|
1702
1720
|
|
|
1703
1721
|
This approach balances immediate user gratification with proper server-side validation, adhering to Apple and Google's guidelines while still maintaining the integrity of your purchase system.
|
|
1704
1722
|
|
|
1723
|
+
## Manual transaction finishing
|
|
1724
|
+
|
|
1725
|
+
By default the plugin finishes StoreKit 2 transactions and acknowledges Google Play purchases automatically. If you must validate on your backend before finishing, disable automatic finishing and complete transactions yourself.
|
|
1726
|
+
|
|
1727
|
+
| Setting | Scope |
|
|
1728
|
+
| -------- | ----- |
|
|
1729
|
+
| `autoFinishTransactions` (default `true`) | Plugin-wide: iOS `transactionUpdated` and `purchaseProduct` when combined with `autoAcknowledgePurchases`. Android `restorePurchases` recovery and `purchaseProduct` when combined with `autoAcknowledgePurchases`. |
|
|
1730
|
+
| `autoAcknowledgePurchases` on `purchaseProduct()` (default `true`) | Per purchase call. Effective auto finish/ack requires both flags to be true. Does not change the iOS `transactionUpdated` listener by itself. |
|
|
1731
|
+
|
|
1732
|
+
Set `autoFinishTransactions: false` in `capacitor.config` under `plugins.NativePurchases` so iOS applies it before the native update listener starts, or call `NativePurchases.configure({ autoFinishTransactions: false })` at startup.
|
|
1733
|
+
|
|
1734
|
+
**iOS recovery flow**
|
|
1735
|
+
|
|
1736
|
+
1. On launch, call `getUnfinishedTransactions()` or listen for `transactionUpdated` (events include `needsFinish: true` when manual mode is on).
|
|
1737
|
+
2. Validate on your backend.
|
|
1738
|
+
3. Call `finishTransaction({ transactionId })` or `acknowledgePurchase({ purchaseToken: transactionId })`. Repeated calls on an already finished transaction succeed.
|
|
1739
|
+
|
|
1740
|
+
**Android**
|
|
1741
|
+
|
|
1742
|
+
After validation when automatic acknowledgment is off (for example `configure({ autoFinishTransactions: false })` or `purchaseProduct({ autoAcknowledgePurchases: false })`), call `consumePurchase({ purchaseToken })` for consumable in-app products (acknowledges and consumes), or `acknowledgePurchase({ purchaseToken })` for non-consumables and subscriptions. `finishTransaction()` is iOS-only and rejects on Android. With `autoFinishTransactions: false`, `restorePurchases()` does not auto-acknowledge; use `getUnfinishedTransactions()` to list unacknowledged purchases in the `PURCHASED` state (`isAcknowledged === false`).
|
|
1743
|
+
|
|
1705
1744
|
## API
|
|
1706
1745
|
|
|
1707
1746
|
<docgen-index>
|
|
1708
1747
|
|
|
1748
|
+
* [`configure(...)`](#configure)
|
|
1709
1749
|
* [`restorePurchases()`](#restorepurchases)
|
|
1710
1750
|
* [`getAppTransaction()`](#getapptransaction)
|
|
1711
1751
|
* [`isEntitledToOldBusinessModel(...)`](#isentitledtooldbusinessmodel)
|
|
@@ -1718,6 +1758,8 @@ This approach balances immediate user gratification with proper server-side vali
|
|
|
1718
1758
|
* [`manageSubscriptions()`](#managesubscriptions)
|
|
1719
1759
|
* [`presentOfferCodeRedeemSheet()`](#presentoffercoderedeemsheet)
|
|
1720
1760
|
* [`acknowledgePurchase(...)`](#acknowledgepurchase)
|
|
1761
|
+
* [`finishTransaction(...)`](#finishtransaction)
|
|
1762
|
+
* [`getUnfinishedTransactions()`](#getunfinishedtransactions)
|
|
1721
1763
|
* [`consumePurchase(...)`](#consumepurchase)
|
|
1722
1764
|
* [`getStorefront()`](#getstorefront)
|
|
1723
1765
|
* [`addListener('transactionUpdated', ...)`](#addlistenertransactionupdated-)
|
|
@@ -1732,6 +1774,41 @@ This approach balances immediate user gratification with proper server-side vali
|
|
|
1732
1774
|
<docgen-api>
|
|
1733
1775
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
1734
1776
|
|
|
1777
|
+
### configure(...)
|
|
1778
|
+
|
|
1779
|
+
```typescript
|
|
1780
|
+
configure(options?: { autoFinishTransactions?: boolean | undefined; } | undefined) => Promise<void>
|
|
1781
|
+
```
|
|
1782
|
+
|
|
1783
|
+
Configure plugin-wide purchase finishing behavior.
|
|
1784
|
+
|
|
1785
|
+
Call this as early as possible (ideally before other NativePurchases APIs). You can also set
|
|
1786
|
+
`autoFinishTransactions` in `capacitor.config` under `plugins.NativePurchases` so iOS applies
|
|
1787
|
+
the value before the native `transactionUpdated` listener starts.
|
|
1788
|
+
|
|
1789
|
+
**`autoFinishTransactions` (default `true`)**
|
|
1790
|
+
|
|
1791
|
+
- **iOS (StoreKit 2)**: When `true`, the plugin finishes transactions automatically for
|
|
1792
|
+
`transactionUpdated`, `restorePurchases`, and `purchaseProduct` (when
|
|
1793
|
+
`autoAcknowledgePurchases` is also true). When `false`, transactions stay unfinished until you call
|
|
1794
|
+
`finishTransaction()` (or `acknowledgePurchase()` with the transaction ID).
|
|
1795
|
+
- **Android**: When `true`, `restorePurchases()` may auto-acknowledge unacknowledged purchases
|
|
1796
|
+
(recovery flow). When `false`, recovery does not acknowledge; use `acknowledgePurchase()`.
|
|
1797
|
+
`purchaseProduct()` auto-acknowledges only when both `autoFinishTransactions` and
|
|
1798
|
+
`autoAcknowledgePurchases` are true.
|
|
1799
|
+
|
|
1800
|
+
**`autoAcknowledgePurchases`** applies only to the `purchaseProduct()` call and does not change
|
|
1801
|
+
how the iOS `transactionUpdated` listener finishes transactions. Use this method (or config) for that.
|
|
1802
|
+
|
|
1803
|
+
| Param | Type |
|
|
1804
|
+
| ------------- | -------------------------------------------------- |
|
|
1805
|
+
| **`options`** | <code>{ autoFinishTransactions?: boolean; }</code> |
|
|
1806
|
+
|
|
1807
|
+
**Since:** 8.9.0
|
|
1808
|
+
|
|
1809
|
+
--------------------
|
|
1810
|
+
|
|
1811
|
+
|
|
1735
1812
|
### restorePurchases()
|
|
1736
1813
|
|
|
1737
1814
|
```typescript
|
|
@@ -1945,7 +2022,9 @@ acknowledgePurchase(options: { purchaseToken: string; }) => Promise<void>
|
|
|
1945
2022
|
|
|
1946
2023
|
Manually acknowledge/finish a purchase transaction.
|
|
1947
2024
|
|
|
1948
|
-
|
|
2025
|
+
Call this when automatic finishing or acknowledgment is disabled, for example
|
|
2026
|
+
`purchaseProduct({ autoAcknowledgePurchases: false })`, `configure({ autoFinishTransactions: false })`
|
|
2027
|
+
(Android recovery or iOS updates), or when a returned transaction has `needsFinish: true`.
|
|
1949
2028
|
|
|
1950
2029
|
**Platform Behavior:**
|
|
1951
2030
|
- **Android**: Acknowledges the purchase with Google Play. Must be called within 3 days or the purchase will be refunded.
|
|
@@ -1982,6 +2061,51 @@ await NativePurchases.acknowledgePurchase({
|
|
|
1982
2061
|
--------------------
|
|
1983
2062
|
|
|
1984
2063
|
|
|
2064
|
+
### finishTransaction(...)
|
|
2065
|
+
|
|
2066
|
+
```typescript
|
|
2067
|
+
finishTransaction(options: { transactionId: string; }) => Promise<void>
|
|
2068
|
+
```
|
|
2069
|
+
|
|
2070
|
+
Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.
|
|
2071
|
+
|
|
2072
|
+
Equivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more
|
|
2073
|
+
than once; finishing an already finished transaction resolves successfully.
|
|
2074
|
+
|
|
2075
|
+
**Android**: Google Play uses purchase acknowledgment, not StoreKit finishing. Call
|
|
2076
|
+
`acknowledgePurchase({ purchaseToken })` instead. This method rejects on Android.
|
|
2077
|
+
|
|
2078
|
+
| Param | Type |
|
|
2079
|
+
| ------------- | --------------------------------------- |
|
|
2080
|
+
| **`options`** | <code>{ transactionId: string; }</code> |
|
|
2081
|
+
|
|
2082
|
+
**Since:** 8.9.0
|
|
2083
|
+
|
|
2084
|
+
--------------------
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
### getUnfinishedTransactions()
|
|
2088
|
+
|
|
2089
|
+
```typescript
|
|
2090
|
+
getUnfinishedTransactions() => Promise<{ transactions: Transaction[]; }>
|
|
2091
|
+
```
|
|
2092
|
+
|
|
2093
|
+
Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.
|
|
2094
|
+
|
|
2095
|
+
Use on app launch when `autoFinishTransactions` is `false` to recover work after a restart.
|
|
2096
|
+
|
|
2097
|
+
**Android recovery:** After validation, call `consumePurchase({ purchaseToken })` for consumable
|
|
2098
|
+
in-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchaseToken })` for
|
|
2099
|
+
non-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not
|
|
2100
|
+
yet acknowledged. Pending purchases are excluded until Google Play marks them purchased.
|
|
2101
|
+
|
|
2102
|
+
**Returns:** <code>Promise<{ transactions: Transaction[]; }></code>
|
|
2103
|
+
|
|
2104
|
+
**Since:** 8.9.0
|
|
2105
|
+
|
|
2106
|
+
--------------------
|
|
2107
|
+
|
|
2108
|
+
|
|
1985
2109
|
### consumePurchase(...)
|
|
1986
2110
|
|
|
1987
2111
|
```typescript
|
|
@@ -2058,6 +2182,11 @@ addListener(eventName: 'transactionUpdated', listenerFunc: (transaction: Transac
|
|
|
2058
2182
|
|
|
2059
2183
|
Listen for StoreKit transaction updates delivered by Apple's <a href="#transaction">Transaction</a>.updates.
|
|
2060
2184
|
Fires on app launch if there are unfinished transactions, and for any updates afterward.
|
|
2185
|
+
|
|
2186
|
+
When `autoFinishTransactions` is `true` (default), the plugin finishes each verified transaction
|
|
2187
|
+
before emitting the event. When `false`, the event includes `needsFinish: true` and you must call
|
|
2188
|
+
`finishTransaction()` after backend validation.
|
|
2189
|
+
|
|
2061
2190
|
iOS only.
|
|
2062
2191
|
|
|
2063
2192
|
| Param | Type |
|
|
@@ -2154,6 +2283,7 @@ which is useful for determining if users are entitled to features from earlier b
|
|
|
2154
2283
|
| **`isTrialPeriod`** | <code>boolean</code> | Whether the transaction is in a trial period. - `true`: Currently in free trial period - `false`: Not in trial period | | 1.0.0 |
|
|
2155
2284
|
| **`isInIntroPricePeriod`** | <code>boolean</code> | Whether the transaction is in an introductory price period. Introductory pricing is a discounted rate, different from a free trial. - `true`: Currently using introductory pricing - `false`: Not in intro period | | 1.0.0 |
|
|
2156
2285
|
| **`isInGracePeriod`** | <code>boolean</code> | Whether the transaction is in a grace period. Grace period allows users to fix payment issues while maintaining access. You typically want to continue providing access during this time. - `true`: Subscription payment failed but user still has access - `false`: Not in grace period | | 1.0.0 |
|
|
2286
|
+
| **`needsFinish`** | <code>boolean</code> | Whether the StoreKit transaction still needs to be finished with `finishTransaction()`. Present when the transaction is returned from `getUnfinishedTransactions()` or from `transactionUpdated` while `autoFinishTransactions` is `false`. | | 8.9.0 |
|
|
2157
2287
|
|
|
2158
2288
|
|
|
2159
2289
|
#### TransactionCommitmentInfo
|
|
@@ -2212,6 +2342,7 @@ which is useful for determining if users are entitled to features from earlier b
|
|
|
2212
2342
|
| **`pricingTerms`** | <code>SubscriptionPricingTerms[]</code> | iOS subscriptions only: StoreKit pricing terms by billing plan. For subscriptions with a monthly billing plan and 12-month commitment, this includes both the standard up-front plan and the monthly commitment plan. Display both `billingDisplayPrice` and `commitmentInfo.priceString` before starting a monthly commitment purchase. | 8.3.8 |
|
|
2213
2343
|
| **`subscriptionPeriod`** | <code><a href="#subscriptionperiod">SubscriptionPeriod</a></code> | The <a href="#product">Product</a> subscription group identifier. | |
|
|
2214
2344
|
| **`introductoryPrice`** | <code><a href="#skproductdiscount">SKProductDiscount</a> \| null</code> | The <a href="#product">Product</a> introductory Price. | |
|
|
2345
|
+
| **`introEligibility`** | <code><a href="#intro_eligibility_status">INTRO_ELIGIBILITY_STATUS</a></code> | Whether the current store account is eligible for an introductory offer on this subscription. | 8.8.3 |
|
|
2215
2346
|
| **`discounts`** | <code>SKProductDiscount[]</code> | The <a href="#product">Product</a> discounts list. | |
|
|
2216
2347
|
|
|
2217
2348
|
|
|
@@ -2316,6 +2447,15 @@ Android one-time product discount display metadata.
|
|
|
2316
2447
|
| **`INAPP`** | <code>'inapp'</code> | A type of SKU for in-app products. |
|
|
2317
2448
|
| **`SUBS`** | <code>'subs'</code> | A type of SKU for subscriptions. |
|
|
2318
2449
|
|
|
2450
|
+
|
|
2451
|
+
#### INTRO_ELIGIBILITY_STATUS
|
|
2452
|
+
|
|
2453
|
+
| Members | Value | Description |
|
|
2454
|
+
| ----------------------------------------- | -------------- | ---------------------------------------------------------------------------- |
|
|
2455
|
+
| **`INTRO_ELIGIBILITY_STATUS_UNKNOWN`** | <code>0</code> | doesn't have enough information to determine eligibility. |
|
|
2456
|
+
| **`INTRO_ELIGIBILITY_STATUS_INELIGIBLE`** | <code>1</code> | The user is not eligible for a free trial or intro pricing for this product. |
|
|
2457
|
+
| **`INTRO_ELIGIBILITY_STATUS_ELIGIBLE`** | <code>2</code> | The user is eligible for a free trial or intro pricing for this product. |
|
|
2458
|
+
|
|
2319
2459
|
</docgen-api>
|
|
2320
2460
|
|
|
2321
2461
|
## App Store Compliance
|
package/android/build.gradle
CHANGED
|
@@ -20,6 +20,9 @@ apply plugin: 'com.android.library'
|
|
|
20
20
|
android {
|
|
21
21
|
namespace = "ee.forgr.nativepurchases"
|
|
22
22
|
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
|
+
buildFeatures {
|
|
24
|
+
buildConfig true
|
|
25
|
+
}
|
|
23
26
|
defaultConfig {
|
|
24
27
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
25
28
|
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
@@ -49,7 +52,6 @@ repositories {
|
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
dependencies {
|
|
52
|
-
implementation "com.google.guava:guava:33.7.1-android"
|
|
53
55
|
def billing_version = "9.1.0"
|
|
54
56
|
implementation "com.android.billingclient:billing:$billing_version"
|
|
55
57
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
package ee.forgr.nativepurchases;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
import com.android.billingclient.api.Purchase;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Centralized logging for the plugin. Debug logs are emitted only when the app is a debug build
|
|
8
|
+
* or {@code debugLogging} is enabled in the plugin config. Sensitive purchase fields are never logged.
|
|
9
|
+
*/
|
|
10
|
+
public final class NativePurchasesLog {
|
|
11
|
+
|
|
12
|
+
private static volatile boolean explicitDebugLogging;
|
|
13
|
+
|
|
14
|
+
private NativePurchasesLog() {}
|
|
15
|
+
|
|
16
|
+
public static void configure(boolean debugLogging) {
|
|
17
|
+
explicitDebugLogging = debugLogging;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static boolean isLoggingEnabled() {
|
|
21
|
+
return BuildConfig.DEBUG || explicitDebugLogging;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static void d(String tag, String message) {
|
|
25
|
+
if (isLoggingEnabled()) {
|
|
26
|
+
Log.d(tag, message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static void i(String tag, String message) {
|
|
31
|
+
if (isLoggingEnabled()) {
|
|
32
|
+
Log.i(tag, message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static void w(String tag, String message) {
|
|
37
|
+
if (isLoggingEnabled()) {
|
|
38
|
+
Log.w(tag, message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static void e(String tag, String message) {
|
|
43
|
+
if (isLoggingEnabled()) {
|
|
44
|
+
Log.e(tag, message);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static String redactSensitive(String value) {
|
|
49
|
+
if (value == null || value.isEmpty()) {
|
|
50
|
+
return "[REDACTED]";
|
|
51
|
+
}
|
|
52
|
+
return "[REDACTED]";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public static String purchaseDebugSummary(Purchase purchase) {
|
|
56
|
+
if (purchase == null) {
|
|
57
|
+
return "purchase=null";
|
|
58
|
+
}
|
|
59
|
+
return (
|
|
60
|
+
"purchase{productIds=" +
|
|
61
|
+
purchase.getProducts() +
|
|
62
|
+
", state=" +
|
|
63
|
+
purchase.getPurchaseState() +
|
|
64
|
+
", acknowledged=" +
|
|
65
|
+
purchase.isAcknowledged() +
|
|
66
|
+
"}"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|