capacitor-plugin-cdv-purchase 13.19.1 → 13.20.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/dist/index.js
CHANGED
|
@@ -631,7 +631,7 @@ var CdvPurchase;
|
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
633
|
else {
|
|
634
|
-
this.controller.unverifiedCallbacks.trigger({ receipt, payload, transient:
|
|
634
|
+
this.controller.unverifiedCallbacks.trigger({ receipt, payload, transient: isRetriableError(payload) }, 'validator_error');
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
catch (err) {
|
|
@@ -640,7 +640,7 @@ var CdvPurchase;
|
|
|
640
640
|
ok: false,
|
|
641
641
|
code: CdvPurchase.ErrorCode.VERIFICATION_FAILED,
|
|
642
642
|
message: err.message,
|
|
643
|
-
}, transient:
|
|
643
|
+
}, transient: true }, 'validator_exception');
|
|
644
644
|
}
|
|
645
645
|
});
|
|
646
646
|
receipts.forEach(receipt => this.runOnReceipt(receipt, onResponse));
|
|
@@ -2053,7 +2053,7 @@ var CdvPurchase;
|
|
|
2053
2053
|
/**
|
|
2054
2054
|
* Current release number of the plugin.
|
|
2055
2055
|
*/
|
|
2056
|
-
CdvPurchase.PLUGIN_VERSION = '13.
|
|
2056
|
+
CdvPurchase.PLUGIN_VERSION = '13.20.0';
|
|
2057
2057
|
/**
|
|
2058
2058
|
* Entry class of the plugin.
|
|
2059
2059
|
*/
|
|
@@ -7851,7 +7851,7 @@ var CdvPurchase;
|
|
|
7851
7851
|
this.products = [{ id: productId }];
|
|
7852
7852
|
this.transactionId = purchase.transactionId;
|
|
7853
7853
|
this.purchaseId = purchase.purchaseId;
|
|
7854
|
-
this.purchaseDate = new Date(purchase.purchaseDate);
|
|
7854
|
+
this.purchaseDate = purchase.purchaseDate ? new Date(purchase.purchaseDate) : undefined;
|
|
7855
7855
|
this.expirationDate = purchase.expirationDate ? new Date(purchase.expirationDate) : undefined;
|
|
7856
7856
|
this.lastRenewalDate = purchase.lastRenewalDate ? new Date(purchase.lastRenewalDate) : undefined;
|
|
7857
7857
|
this.renewalIntent = purchase.renewalIntent === 'Renew' ? CdvPurchase.RenewalIntent.RENEW : CdvPurchase.RenewalIntent.LAPSE;
|
|
@@ -7970,7 +7970,7 @@ var CdvPurchase;
|
|
|
7970
7970
|
billingPeriod: pp.billingPeriod,
|
|
7971
7971
|
paymentMode: pp.paymentMode,
|
|
7972
7972
|
recurrenceMode: pp.recurrenceMode,
|
|
7973
|
-
price: window.IapticJS.Utils.formatCurrency(pp.priceMicros, pp.currency) // Use Utils for formatting
|
|
7973
|
+
price: pp.currency ? window.IapticJS.Utils.formatCurrency(pp.priceMicros, pp.currency) : '' // Use Utils for formatting
|
|
7974
7974
|
})),
|
|
7975
7975
|
}, this.context.apiDecorators);
|
|
7976
7976
|
product.addOffer(offer);
|
|
@@ -9442,6 +9442,7 @@ var CdvPurchase;
|
|
|
9442
9442
|
this.latestReceipt = response.latest_receipt;
|
|
9443
9443
|
this.nativeTransactions = [response.transaction];
|
|
9444
9444
|
this.warning = response.warning;
|
|
9445
|
+
this.cache = response.cache;
|
|
9445
9446
|
this.validationDate = response.date ? new Date(response.date) : new Date();
|
|
9446
9447
|
Object.defineProperty(this, 'raw', { 'enumerable': false, get() { return response; } });
|
|
9447
9448
|
Object.defineProperty(this, 'finish', { 'enumerable': false, get() { return () => decorator.finish(this); } });
|
|
@@ -9463,6 +9464,7 @@ var CdvPurchase;
|
|
|
9463
9464
|
this.latestReceipt = response.latest_receipt;
|
|
9464
9465
|
this.nativeTransactions = [response.transaction];
|
|
9465
9466
|
this.warning = response.warning;
|
|
9467
|
+
this.cache = response.cache;
|
|
9466
9468
|
}
|
|
9467
9469
|
/** Finish all transactions in the receipt */
|
|
9468
9470
|
finish() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["esm/index.js","../build/entry.mjs"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Set the marker so the shared store.js knows Capacitor native bridges are available\nif (typeof window !== 'undefined') {\n window.CdvPurchaseCapacitor = { installed: true };\n}\nconst PurchasePlugin = registerPlugin('PurchasePlugin');\nexport { PurchasePlugin };\n","// Capacitor bridge — sets CdvPurchaseCapacitor marker and registers native plugin\nexport { PurchasePlugin } from '../dist/esm/index.js';\n\n// Store runtime — executes the IIFE, creates window.CdvPurchase\nimport { CdvPurchase } from 'virtual:store-js';\n\n// Re-export the full namespace\nexport { CdvPurchase };\n\n// Convenience named exports\nexport const store = CdvPurchase.store;\nexport const Store = CdvPurchase.Store;\nexport const ProductType = CdvPurchase.ProductType;\nexport const Platform = CdvPurchase.Platform;\nexport const LogLevel = CdvPurchase.LogLevel;\nexport const ErrorCode = CdvPurchase.ErrorCode;\nexport const Logger = CdvPurchase.Logger;\nexport const Iaptic = CdvPurchase.Iaptic;\n"],"names":[],"mappings":";;AACA;AACA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACnC,IAAI,MAAM,CAAC,oBAAoB,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE;AACrD;AACK,MAAC,cAAc,GAAG,cAAc,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AW,CAAC;AACxB,MAAC,SAAS,GAAG,WAAW,CAAC;AACzB,MAAC,MAAM,GAAG,WAAW,CAAC;AACtB,MAAC,MAAM,GAAG,WAAW,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["esm/index.js","../build/entry.mjs"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Set the marker so the shared store.js knows Capacitor native bridges are available\nif (typeof window !== 'undefined') {\n window.CdvPurchaseCapacitor = { installed: true };\n}\nconst PurchasePlugin = registerPlugin('PurchasePlugin');\nexport { PurchasePlugin };\n","// Capacitor bridge — sets CdvPurchaseCapacitor marker and registers native plugin\nexport { PurchasePlugin } from '../dist/esm/index.js';\n\n// Store runtime — executes the IIFE, creates window.CdvPurchase\nimport { CdvPurchase } from 'virtual:store-js';\n\n// Re-export the full namespace\nexport { CdvPurchase };\n\n// Convenience named exports\nexport const store = CdvPurchase.store;\nexport const Store = CdvPurchase.Store;\nexport const ProductType = CdvPurchase.ProductType;\nexport const Platform = CdvPurchase.Platform;\nexport const LogLevel = CdvPurchase.LogLevel;\nexport const ErrorCode = CdvPurchase.ErrorCode;\nexport const Logger = CdvPurchase.Logger;\nexport const Iaptic = CdvPurchase.Iaptic;\n"],"names":[],"mappings":";;AACA;AACA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACnC,IAAI,MAAM,CAAC,oBAAoB,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE;AACrD;AACK,MAAC,cAAc,GAAG,cAAc,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;ACLtD;;AASA;AACY,MAAC,KAAK,GAAG,WAAW,CAAC;AACrB,MAAC,KAAK,GAAG,WAAW,CAAC;AACrB,MAAC,WAAW,GAAG,WAAW,CAAC;AAC3B,MAAC,QAAQ,GAAG,WAAW,CAAC;AACxB,MAAC,QAAQ,GAAG,WAAW,CAAC;AACxB,MAAC,SAAS,GAAG,WAAW,CAAC;AACzB,MAAC,MAAM,GAAG,WAAW,CAAC;AACtB,MAAC,MAAM,GAAG,WAAW,CAAC;;;;"}
|
|
@@ -614,7 +614,7 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
614
614
|
private func paymentModeToString(_ mode: Product.SubscriptionOffer.PaymentMode) -> String {
|
|
615
615
|
switch mode {
|
|
616
616
|
case .payAsYouGo: return "PayAsYouGo"
|
|
617
|
-
case .payUpFront: return "
|
|
617
|
+
case .payUpFront: return "UpFront"
|
|
618
618
|
case .freeTrial: return "FreeTrial"
|
|
619
619
|
default: return "PayAsYouGo"
|
|
620
620
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
declare namespace ModuleIapticJS {
|
|
2
2
|
/**
|
|
3
|
-
* Type of product that can be purchased
|
|
3
|
+
* Type of product that can be purchased:
|
|
4
|
+
*
|
|
5
|
+
* - subscription: A recurring subscription product
|
|
6
|
+
* - consumable: A product that can be purchased multiple times
|
|
7
|
+
* - non consumable: A product that can only be purchased once
|
|
8
|
+
* - paid subscription: An auto-renewing subscription
|
|
9
|
+
* - non renewing subscription: A subscription that does not auto-renew
|
|
10
|
+
* - application: The application itself
|
|
11
|
+
* - product: A generic product
|
|
12
|
+
*
|
|
13
|
+
* `'non_consumable'` is deprecated: the server never sends it. It is kept so existing
|
|
14
|
+
* code compiles, and will be removed in the next major version. Use `'non consumable'`.
|
|
4
15
|
*/
|
|
5
|
-
export type ProductType = 'subscription' | 'consumable' | 'non consumable' | 'paid subscription';
|
|
6
|
-
|
|
16
|
+
export type ProductType = 'subscription' | 'consumable' | 'non consumable' | 'paid subscription' | 'non renewing subscription' | 'application' | 'product' | 'non_consumable';
|
|
7
17
|
/**
|
|
8
18
|
* Represents a pricing phase for an offer
|
|
19
|
+
* @remarks
|
|
20
|
+
* A pricing phase defines how much and when a customer will be charged.
|
|
21
|
+
* For example, a subscription might have an initial trial phase followed by a recurring payment phase.
|
|
9
22
|
*/
|
|
10
23
|
export interface PricingPhase {
|
|
11
24
|
/** Price in micros (1/1,000,000 of the currency unit). For example, $1.99 = 1990000 micros */
|
|
@@ -14,21 +27,38 @@ declare namespace ModuleIapticJS {
|
|
|
14
27
|
currency: string;
|
|
15
28
|
/**
|
|
16
29
|
* ISO 8601 duration string representing the billing period
|
|
17
|
-
*
|
|
30
|
+
* @example
|
|
31
|
+
* - 'P1M' = 1 month
|
|
32
|
+
* - 'P1Y' = 1 year
|
|
33
|
+
* - 'P7D' = 7 days
|
|
34
|
+
*
|
|
35
|
+
* Absent for one-time purchases.
|
|
18
36
|
*/
|
|
19
37
|
billingPeriod: string;
|
|
20
38
|
/**
|
|
21
39
|
* Defines how the subscription recurs
|
|
40
|
+
* @remarks
|
|
41
|
+
* - INFINITE_RECURRING: Subscription continues until explicitly cancelled
|
|
42
|
+
* - NON_RECURRING: One-time purchase that does not auto-renew
|
|
43
|
+
* - FINITE_RECURRING: Subscription that renews a fixed number of times
|
|
22
44
|
*/
|
|
23
45
|
recurrenceMode: 'INFINITE_RECURRING' | 'NON_RECURRING' | 'FINITE_RECURRING';
|
|
24
46
|
/**
|
|
25
47
|
* Defines when payment is collected
|
|
48
|
+
* @remarks
|
|
49
|
+
* - PayAsYouGo: Payment collected at the start of each billing period
|
|
50
|
+
* - UpFront: Full payment collected at time of purchase
|
|
51
|
+
* - FreeTrial: No payment during this phase
|
|
52
|
+
*
|
|
53
|
+
* `'PayUpFront'` is deprecated: the server never sends it. It is kept so existing
|
|
54
|
+
* code compiles, and will be removed in the next major version. Use `'UpFront'`.
|
|
26
55
|
*/
|
|
27
|
-
paymentMode: 'PayAsYouGo' | 'PayUpFront';
|
|
56
|
+
paymentMode: 'PayAsYouGo' | 'UpFront' | 'FreeTrial' | 'PayUpFront';
|
|
28
57
|
}
|
|
29
|
-
|
|
30
58
|
/**
|
|
31
59
|
* Represents a purchase offer for a product
|
|
60
|
+
* @remarks
|
|
61
|
+
* An offer defines how a product can be purchased, including pricing and billing details
|
|
32
62
|
*/
|
|
33
63
|
export interface Offer {
|
|
34
64
|
/** Unique identifier for the offer in the format 'platform:id' */
|
|
@@ -36,11 +66,10 @@ declare namespace ModuleIapticJS {
|
|
|
36
66
|
/** Payment platform identifier (e.g., 'stripe', 'google', 'apple') */
|
|
37
67
|
platform: string;
|
|
38
68
|
/** Type of the offer */
|
|
39
|
-
offerType: 'Subscription' | 'Default';
|
|
69
|
+
offerType: 'Subscription' | 'Default' | 'Introductory';
|
|
40
70
|
/** Array of pricing phases that make up this offer's payment schedule */
|
|
41
71
|
pricingPhases: PricingPhase[];
|
|
42
72
|
}
|
|
43
|
-
|
|
44
73
|
/**
|
|
45
74
|
* Represents a product that can be purchased
|
|
46
75
|
*/
|
|
@@ -57,12 +86,13 @@ declare namespace ModuleIapticJS {
|
|
|
57
86
|
offers: Offer[];
|
|
58
87
|
/**
|
|
59
88
|
* Optional additional data associated with the product
|
|
89
|
+
* @remarks
|
|
90
|
+
* This can be used to store custom data needed by your application
|
|
60
91
|
*/
|
|
61
92
|
metadata?: Record<string, any>;
|
|
62
93
|
/** Optional platform identifier (e.g., 'stripe') */
|
|
63
94
|
platform?: string;
|
|
64
95
|
}
|
|
65
|
-
|
|
66
96
|
/**
|
|
67
97
|
* Represents a purchased product
|
|
68
98
|
*/
|
|
@@ -75,14 +105,19 @@ declare namespace ModuleIapticJS {
|
|
|
75
105
|
productId: string;
|
|
76
106
|
/** Platform identifier (e.g., 'stripe') */
|
|
77
107
|
platform: 'stripe';
|
|
78
|
-
/** Date of the purchase */
|
|
108
|
+
/** Date of the purchase (ISO 8601). Can be absent, check before use. */
|
|
79
109
|
purchaseDate: string;
|
|
80
|
-
/** Date of the last renewal */
|
|
110
|
+
/** Date of the last renewal (ISO 8601). Can be absent, check before use. */
|
|
81
111
|
lastRenewalDate: string;
|
|
82
|
-
/** Date of the expiration */
|
|
112
|
+
/** Date of the expiration (ISO 8601). Absent for one-time purchases. */
|
|
83
113
|
expirationDate: string;
|
|
84
|
-
/**
|
|
85
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Intent of the renewal: 'Lapse' to let the subscription expire, 'Renew' to keep it
|
|
116
|
+
*
|
|
117
|
+
* `'Cancel'` is deprecated: the server never sends it. It is kept so existing
|
|
118
|
+
* code compiles, and will be removed in the next major version. Use `'Lapse'`.
|
|
119
|
+
*/
|
|
120
|
+
renewalIntent: 'Lapse' | 'Renew' | 'Cancel';
|
|
86
121
|
/** Whether the purchase is a trial period */
|
|
87
122
|
isTrialPeriod: boolean;
|
|
88
123
|
/** Price in micros (1/1,000,000 of the currency unit) */
|
|
@@ -90,7 +125,6 @@ declare namespace ModuleIapticJS {
|
|
|
90
125
|
/** Currency code (e.g., 'USD', 'EUR') */
|
|
91
126
|
currency: string;
|
|
92
127
|
}
|
|
93
|
-
|
|
94
128
|
/**
|
|
95
129
|
* Represents an order for a product
|
|
96
130
|
*/
|
|
@@ -106,35 +140,55 @@ declare namespace ModuleIapticJS {
|
|
|
106
140
|
/** Optional access token for the user */
|
|
107
141
|
accessToken?: string;
|
|
108
142
|
}
|
|
109
|
-
|
|
110
143
|
/** Plan change request */
|
|
111
144
|
export interface PlanChange {
|
|
112
|
-
/** Unique identifier for the purchase to replace
|
|
145
|
+
/** Unique identifier for the purchase to replace */
|
|
113
146
|
purchaseId: string;
|
|
114
147
|
/** New offer to subscribe to */
|
|
115
148
|
offerId: string;
|
|
116
149
|
/** Optional access token for the user */
|
|
117
150
|
accessToken?: string;
|
|
118
151
|
}
|
|
119
|
-
|
|
120
152
|
/**
|
|
121
153
|
* Configuration options for creating an Iaptic adapter
|
|
154
|
+
* @remarks
|
|
155
|
+
* Currently only supports Stripe integration, but may support other platforms in the future
|
|
122
156
|
*/
|
|
123
157
|
export interface Config {
|
|
124
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Adapter type (currently only 'stripe' is supported)
|
|
160
|
+
* @remarks
|
|
161
|
+
* This field determines which payment platform will be used
|
|
162
|
+
*/
|
|
125
163
|
type: 'stripe';
|
|
126
|
-
/**
|
|
127
|
-
|
|
128
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Your application name as configured on iaptic.com
|
|
166
|
+
* @remarks
|
|
167
|
+
* This must match exactly what you set up in the Iaptic dashboard
|
|
168
|
+
*/
|
|
129
169
|
appName: string;
|
|
130
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Your Iaptic public API key
|
|
172
|
+
* @remarks
|
|
173
|
+
* Can be found in your Iaptic dashboard under API settings
|
|
174
|
+
*/
|
|
131
175
|
apiKey: string;
|
|
132
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Stripe publishable key
|
|
178
|
+
*/
|
|
179
|
+
stripePublicKey: string;
|
|
180
|
+
/**
|
|
181
|
+
* Optional custom Iaptic URL for private deployments
|
|
182
|
+
* @remarks
|
|
183
|
+
* Only needed if you're using a self-hosted version of Iaptic
|
|
184
|
+
*/
|
|
133
185
|
customIapticUrl?: string;
|
|
134
186
|
}
|
|
135
|
-
|
|
187
|
+
|
|
188
|
+
|
|
136
189
|
/**
|
|
137
190
|
* Response from Iaptic's /stripe/products API
|
|
191
|
+
* @internal
|
|
138
192
|
*/
|
|
139
193
|
export interface GetProductsResponse {
|
|
140
194
|
/** Whether the request was successful */
|
|
@@ -142,9 +196,9 @@ declare namespace ModuleIapticJS {
|
|
|
142
196
|
/** Array of available products */
|
|
143
197
|
products: Product[];
|
|
144
198
|
}
|
|
145
|
-
|
|
146
199
|
/**
|
|
147
200
|
* Response from Iaptic's /stripe/checkout API
|
|
201
|
+
* @internal
|
|
148
202
|
*/
|
|
149
203
|
export interface PostCheckoutSessionResponse {
|
|
150
204
|
/** Whether the request was successful */
|
|
@@ -154,9 +208,9 @@ declare namespace ModuleIapticJS {
|
|
|
154
208
|
/** Access token for the customer */
|
|
155
209
|
accessToken: string;
|
|
156
210
|
}
|
|
157
|
-
|
|
158
211
|
/**
|
|
159
212
|
* Response from Iaptic's /stripe/purchases API
|
|
213
|
+
* @internal
|
|
160
214
|
*/
|
|
161
215
|
export interface GetPurchasesResponse {
|
|
162
216
|
/** Whether the request was successful */
|
|
@@ -166,9 +220,9 @@ declare namespace ModuleIapticJS {
|
|
|
166
220
|
/** Optional new access token */
|
|
167
221
|
newAccessToken?: string;
|
|
168
222
|
}
|
|
169
|
-
|
|
170
223
|
/**
|
|
171
224
|
* Response from Iaptic's /stripe/change-plan API
|
|
225
|
+
* @internal
|
|
172
226
|
*/
|
|
173
227
|
export interface ChangePlanResponse {
|
|
174
228
|
/** Whether the request was successful */
|
|
@@ -178,133 +232,204 @@ declare namespace ModuleIapticJS {
|
|
|
178
232
|
/** Optional new access token */
|
|
179
233
|
newAccessToken?: string;
|
|
180
234
|
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Represents a scheduled refresh for a subscription
|
|
184
|
-
*/
|
|
185
|
-
export interface ScheduledRefresh {
|
|
186
|
-
/** Unique identifier for the scheduled refresh */
|
|
187
|
-
id: string;
|
|
188
|
-
/** Unique identifier for the subscription */
|
|
189
|
-
subscriptionId: string;
|
|
190
|
-
/** Date and time of the scheduled refresh */
|
|
191
|
-
scheduledAt: number;
|
|
192
|
-
/** Whether the refresh has been completed */
|
|
193
|
-
completed: boolean;
|
|
194
|
-
/** Whether the refresh is currently in progress */
|
|
195
|
-
inProgress: boolean;
|
|
196
|
-
/** Reason for the scheduled refresh */
|
|
197
|
-
reason: string;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* RefreshScheduler class for managing subscription refreshes
|
|
202
|
-
*/
|
|
203
|
-
export class RefreshScheduler {
|
|
204
|
-
schedules: ScheduledRefresh[];
|
|
205
|
-
constructor(iapticStripe: IapticStripe);
|
|
206
|
-
scheduleRefresh(subscriptionId: string, date: Date, reason: string): void;
|
|
207
|
-
schedulePurchaseRefreshes(purchase: Purchase): void;
|
|
208
|
-
clearSchedules(): void;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
235
|
/**
|
|
212
236
|
* Main class for interacting with Iaptic's Stripe integration
|
|
237
|
+
* @remarks
|
|
238
|
+
* This class handles all Stripe-related operations including product listing,
|
|
239
|
+
* checkout sessions, and subscription management.
|
|
213
240
|
*/
|
|
214
241
|
export class IapticStripe {
|
|
215
242
|
/**
|
|
216
243
|
* Creates a new IapticStripe instance
|
|
217
244
|
* @param config - Configuration options for the Stripe integration
|
|
245
|
+
* @throws Error if required configuration is missing
|
|
218
246
|
*/
|
|
219
247
|
constructor(config: Config);
|
|
220
|
-
|
|
221
248
|
/**
|
|
222
249
|
* Gets a list of available products and their pricing
|
|
223
250
|
* @returns Promise resolving to an array of products
|
|
251
|
+
* @remarks
|
|
252
|
+
* Results are cached locally. Use refreshProducts() to force a fresh fetch.
|
|
224
253
|
*/
|
|
225
254
|
getProducts(): Promise<Product[]>;
|
|
226
|
-
|
|
227
255
|
/**
|
|
228
256
|
* Forces a refresh of the products list from the server
|
|
229
257
|
* @returns Promise resolving to an array of products
|
|
230
258
|
*/
|
|
231
259
|
refreshProducts(): Promise<Product[]>;
|
|
232
|
-
|
|
233
260
|
/**
|
|
234
261
|
* Gets the current access token if one exists
|
|
235
262
|
* @returns The current access token or undefined if none exists
|
|
236
263
|
*/
|
|
237
264
|
getAccessToken(): string | undefined;
|
|
238
|
-
|
|
239
265
|
/**
|
|
240
266
|
* Creates a new order and redirects to Stripe Checkout
|
|
241
267
|
* @param params - Order parameters including product and URLs
|
|
268
|
+
* @throws Error if the checkout session creation fails
|
|
269
|
+
* @remarks
|
|
270
|
+
* This method will redirect the user to Stripe's checkout page on success
|
|
242
271
|
*/
|
|
243
272
|
order(params: Order): Promise<void>;
|
|
244
|
-
|
|
245
273
|
/**
|
|
246
274
|
* Gets the customer's purchase history
|
|
247
275
|
* @param accessToken - Optional access token (uses stored token if not provided)
|
|
248
276
|
* @returns Promise resolving to an array of purchases
|
|
277
|
+
* @remarks
|
|
278
|
+
* This method will automatically schedule refresh operations for active subscriptions
|
|
249
279
|
*/
|
|
250
280
|
getPurchases(accessToken?: string): Promise<Purchase[]>;
|
|
251
|
-
|
|
252
281
|
/**
|
|
253
282
|
* Redirects to Stripe Customer Portal for subscription management
|
|
254
283
|
* @param params - Portal parameters including return URL
|
|
284
|
+
* @throws Error if portal session creation fails
|
|
285
|
+
* @remarks
|
|
286
|
+
* This method will redirect the user to Stripe's customer portal on success
|
|
255
287
|
*/
|
|
256
288
|
redirectToCustomerPortal(params: {
|
|
257
289
|
returnUrl?: string;
|
|
258
290
|
accessToken?: string;
|
|
259
291
|
}): Promise<void>;
|
|
260
|
-
|
|
261
292
|
/**
|
|
262
293
|
* Changes a subscription plan
|
|
263
294
|
* @param planChange - Plan change parameters
|
|
264
295
|
* @returns Promise resolving to the updated purchase details
|
|
296
|
+
* @remarks
|
|
297
|
+
* This method handles immediate plan changes without requiring customer portal access
|
|
265
298
|
*/
|
|
266
299
|
changePlan(planChange: PlanChange): Promise<Purchase>;
|
|
267
|
-
|
|
268
300
|
/**
|
|
269
301
|
* Clears all stored data including access tokens and cached products
|
|
270
302
|
*/
|
|
271
303
|
clearStoredData(): void;
|
|
304
|
+
onAccessTokenChange(callback: (accessToken: string) => void): void;
|
|
272
305
|
}
|
|
273
|
-
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Represents a scheduled refresh for a subscription
|
|
311
|
+
*/
|
|
312
|
+
export interface ScheduledRefresh {
|
|
313
|
+
/** Unique identifier for the scheduled refresh */
|
|
314
|
+
id: string;
|
|
315
|
+
/** Unique identifier for the subscription */
|
|
316
|
+
subscriptionId: string;
|
|
317
|
+
/** Date and time of the scheduled refresh */
|
|
318
|
+
scheduledAt: number;
|
|
319
|
+
/** Whether the refresh has been completed */
|
|
320
|
+
completed: boolean;
|
|
321
|
+
/** Whether the refresh is currently in progress */
|
|
322
|
+
inProgress: boolean;
|
|
323
|
+
/** Reason for the scheduled refresh */
|
|
324
|
+
reason: string;
|
|
325
|
+
}
|
|
326
|
+
export class RefreshScheduler {
|
|
327
|
+
schedules: ScheduledRefresh[];
|
|
328
|
+
constructor(iapticStripe: IapticStripe);
|
|
329
|
+
scheduleRefresh(subscriptionId: string, date: Date, reason: string): void;
|
|
330
|
+
schedulePurchaseRefreshes(purchase: Purchase): void;
|
|
331
|
+
clearSchedules(): void;
|
|
332
|
+
}
|
|
333
|
+
|
|
274
334
|
/**
|
|
275
335
|
* Utility functions for the Iaptic library
|
|
276
336
|
*/
|
|
277
337
|
export class Utils {
|
|
338
|
+
/**
|
|
339
|
+
* Base64 encode a string with fallbacks for different environments
|
|
340
|
+
* @param str - String to encode
|
|
341
|
+
* @returns Base64 encoded string
|
|
342
|
+
* @remarks
|
|
343
|
+
* Handles non-ASCII characters and provides fallbacks for older browsers
|
|
344
|
+
* and Node.js environments
|
|
345
|
+
*/
|
|
346
|
+
static base64Encode(str: string): string;
|
|
347
|
+
/**
|
|
348
|
+
* Get and parse a JSON item from localStorage
|
|
349
|
+
* @param key - Storage key
|
|
350
|
+
* @returns Parsed value or null if not found/invalid
|
|
351
|
+
* @internal
|
|
352
|
+
*/
|
|
353
|
+
static storageGetJson<T>(key: string): T | null;
|
|
354
|
+
/**
|
|
355
|
+
* Get a string item from localStorage
|
|
356
|
+
* @param key - Storage key
|
|
357
|
+
* @returns String value or null if not found
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
static storageGetString(key: string): string | null;
|
|
361
|
+
/**
|
|
362
|
+
* Store a JSON-serializable value in localStorage
|
|
363
|
+
* @param key - Storage key
|
|
364
|
+
* @param value - Value to store
|
|
365
|
+
* @returns true if successful, false if storage failed
|
|
366
|
+
* @internal
|
|
367
|
+
*/
|
|
368
|
+
static storageSetJson(key: string, value: any): boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Store a string value in localStorage
|
|
371
|
+
* @param key - Storage key
|
|
372
|
+
* @param value - String to store
|
|
373
|
+
* @returns true if successful, false if storage failed
|
|
374
|
+
* @internal
|
|
375
|
+
*/
|
|
376
|
+
static storageSetString(key: string, value: string): boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Remove an item from localStorage
|
|
379
|
+
* @param key - Storage key
|
|
380
|
+
* @returns true if successful, false if removal failed
|
|
381
|
+
* @internal
|
|
382
|
+
*/
|
|
383
|
+
static storageRemove(key: string): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Build a URL with query parameters
|
|
386
|
+
* @param baseUrl - Base URL without query parameters
|
|
387
|
+
* @param params - Object containing query parameters
|
|
388
|
+
* @returns Complete URL with encoded query parameters
|
|
389
|
+
* @remarks
|
|
390
|
+
* Handles URL encoding and removes undefined/null parameters
|
|
391
|
+
* @internal
|
|
392
|
+
*/
|
|
393
|
+
static buildUrl(baseUrl: string, params: Record<string, string>): string;
|
|
278
394
|
/**
|
|
279
395
|
* Format a currency amount from micros with proper localization
|
|
280
396
|
* @param amountMicros - Amount in micros (1/1,000,000 of currency unit)
|
|
281
397
|
* @param currency - ISO 4217 currency code (e.g., 'USD', 'EUR')
|
|
282
398
|
* @returns Formatted currency string
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* Utils.formatCurrency(1990000, 'USD') // Returns "$1.99"
|
|
402
|
+
* Utils.formatCurrency(1000000, 'EUR') // Returns "€1"
|
|
403
|
+
* ```
|
|
283
404
|
*/
|
|
284
405
|
static formatCurrency(amountMicros: number, currency: string): string;
|
|
285
|
-
|
|
286
406
|
/**
|
|
287
407
|
* Format an ISO 8601 period string into human-readable English
|
|
288
408
|
* @param period - ISO 8601 duration string
|
|
289
409
|
* @returns Human-readable period string
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* Utils.formatBillingPeriodEN('P1M') // Returns "Monthly"
|
|
413
|
+
* Utils.formatBillingPeriodEN('P3M') // Returns "Every 3 months"
|
|
414
|
+
* Utils.formatBillingPeriodEN('P1Y') // Returns "Yearly"
|
|
415
|
+
* ```
|
|
290
416
|
*/
|
|
291
417
|
static formatBillingPeriodEN(period: string): string;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Base64 encode a string with fallbacks for different environments
|
|
295
|
-
*/
|
|
296
|
-
static base64Encode(str: string): string;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Build a URL with query parameters
|
|
300
|
-
*/
|
|
301
|
-
static buildUrl(baseUrl: string, params: Record<string, string>): string;
|
|
302
418
|
}
|
|
303
|
-
|
|
419
|
+
|
|
304
420
|
/**
|
|
305
421
|
* Creates an Iaptic adapter for the specified payment platform
|
|
306
422
|
* @param config - Configuration options for the adapter
|
|
307
423
|
* @returns An initialized adapter instance
|
|
424
|
+
* @throws Error if the specified adapter type is not supported
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* const iaptic = createAdapter({
|
|
428
|
+
* type: 'stripe',
|
|
429
|
+
* appName: 'my-app',
|
|
430
|
+
* apiKey: '1234567890'
|
|
431
|
+
* });
|
|
432
|
+
* ```
|
|
308
433
|
*/
|
|
309
434
|
export function createAdapter(config: Config): IapticStripe;
|
|
310
435
|
}
|
package/www/store.d.ts
CHANGED
|
@@ -1072,7 +1072,7 @@ declare namespace CdvPurchase {
|
|
|
1072
1072
|
/**
|
|
1073
1073
|
* Current release number of the plugin.
|
|
1074
1074
|
*/
|
|
1075
|
-
const PLUGIN_VERSION = "13.
|
|
1075
|
+
const PLUGIN_VERSION = "13.20.0";
|
|
1076
1076
|
/**
|
|
1077
1077
|
* Entry class of the plugin.
|
|
1078
1078
|
*/
|
|
@@ -6683,6 +6683,9 @@ declare namespace CdvPurchase {
|
|
|
6683
6683
|
*
|
|
6684
6684
|
* It might be present when the server had to fallback to a backup validation solution. */
|
|
6685
6685
|
warning?: string;
|
|
6686
|
+
/** Present when the server answered from its last successful validation of this
|
|
6687
|
+
* receipt because the store couldn't be reached, instead of asking the store. */
|
|
6688
|
+
cache?: ValidatorCacheInfo;
|
|
6686
6689
|
/** Date and time the receipt was validated.
|
|
6687
6690
|
*
|
|
6688
6691
|
* It will provide the client with a more reliable clock time
|
|
@@ -6690,6 +6693,15 @@ declare namespace CdvPurchase {
|
|
|
6690
6693
|
date?: ISODate;
|
|
6691
6694
|
};
|
|
6692
6695
|
}
|
|
6696
|
+
/** Marker added by the validator to an answer that wasn't confirmed by the store just now. */
|
|
6697
|
+
interface ValidatorCacheInfo {
|
|
6698
|
+
/** Where the answer comes from. `last-verified`: the last answer the store confirmed for this exact receipt. */
|
|
6699
|
+
source: 'last-verified' | (string & {});
|
|
6700
|
+
/** Why the cache was used. `store_unreachable`: the store (Apple, Google, ...) couldn't be reached. */
|
|
6701
|
+
reason: 'store_unreachable' | (string & {});
|
|
6702
|
+
/** When the store last confirmed this receipt (ISO 8601). */
|
|
6703
|
+
lastConfirmedAt: ISODate;
|
|
6704
|
+
}
|
|
6693
6705
|
type NativeTransaction = ({
|
|
6694
6706
|
type: 'braintree';
|
|
6695
6707
|
data: Braintree.TransactionObject;
|
|
@@ -6763,15 +6775,20 @@ declare namespace CdvPurchase {
|
|
|
6763
6775
|
receipt: Receipt;
|
|
6764
6776
|
payload: Validator.Response.ErrorPayload;
|
|
6765
6777
|
/**
|
|
6766
|
-
* True when validation failed
|
|
6767
|
-
* (or the store behind it) couldn't be
|
|
6768
|
-
* with a server error
|
|
6778
|
+
* True when validation failed without a definitive answer about the
|
|
6779
|
+
* receipt: the validator (or the store behind it) couldn't be
|
|
6780
|
+
* reached, timed out, answered with a server error, or responded with
|
|
6781
|
+
* data the plugin couldn't process. The receipt may well be valid.
|
|
6769
6782
|
*
|
|
6770
6783
|
* Don't revoke access on a transient failure: keep what your app (or
|
|
6771
6784
|
* your server) last knew, and validate again later.
|
|
6772
6785
|
*
|
|
6773
6786
|
* The plugin already retried a few times (with backoff) before firing
|
|
6774
|
-
* a transient failure.
|
|
6787
|
+
* a transient failure. This matches the plugin's own retry decision:
|
|
6788
|
+
* since v13.20.0, `BAD_RESPONSE` (the validator's answer was
|
|
6789
|
+
* malformed) and `VERIFICATION_FAILED` (the plugin failed while
|
|
6790
|
+
* processing the validator's answer) are reported as transient (they
|
|
6791
|
+
* used to be `transient: false`).
|
|
6775
6792
|
*
|
|
6776
6793
|
* False when the validator gave a definitive answer (e.g. invalid
|
|
6777
6794
|
* receipt, expired subscription, authentication error).
|
|
@@ -6780,6 +6797,9 @@ declare namespace CdvPurchase {
|
|
|
6780
6797
|
* - HTTP 5xx, from the transport or as `payload.status` in the response body
|
|
6781
6798
|
* - `CONNECTION_FAILED` (6778002) from the validator
|
|
6782
6799
|
* - request timeout, no network, unreadable response
|
|
6800
|
+
* - `BAD_RESPONSE`: the validator's answer was malformed
|
|
6801
|
+
* - `VERIFICATION_FAILED`: the plugin failed while processing the
|
|
6802
|
+
* validator's answer
|
|
6783
6803
|
*
|
|
6784
6804
|
* Definitive: everything else (HTTP 400 `INVALID_PAYLOAD`, 401/403, 410,
|
|
6785
6805
|
* 419 expired, ...).
|
|
@@ -6819,6 +6839,17 @@ declare namespace CdvPurchase {
|
|
|
6819
6839
|
* When a warning is present, you should threat the content of this receipt accordingly.
|
|
6820
6840
|
*/
|
|
6821
6841
|
warning?: string;
|
|
6842
|
+
/**
|
|
6843
|
+
* Set when the validator answered from its last successful validation of this receipt,
|
|
6844
|
+
* because the store (Apple, Google, ...) couldn't be reached.
|
|
6845
|
+
*
|
|
6846
|
+
* `undefined` means the store confirmed this receipt during the validation.
|
|
6847
|
+
* The content is the last one confirmed by the store, `cache.lastConfirmedAt` tells when.
|
|
6848
|
+
*
|
|
6849
|
+
* Receipts with a `cache` are as valid as the others (no purchase is owned past its `expiryDate`),
|
|
6850
|
+
* but you might prefer to validate again later, or tell your users.
|
|
6851
|
+
*/
|
|
6852
|
+
cache?: Validator.Response.ValidatorCacheInfo;
|
|
6822
6853
|
/**
|
|
6823
6854
|
* Id of the product that have been validated. Used internally.
|
|
6824
6855
|
*/
|
package/www/store.js
CHANGED
|
@@ -636,7 +636,7 @@ var CdvPurchase;
|
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
else {
|
|
639
|
-
this.controller.unverifiedCallbacks.trigger({ receipt, payload, transient:
|
|
639
|
+
this.controller.unverifiedCallbacks.trigger({ receipt, payload, transient: isRetriableError(payload) }, 'validator_error');
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
catch (err) {
|
|
@@ -645,7 +645,7 @@ var CdvPurchase;
|
|
|
645
645
|
ok: false,
|
|
646
646
|
code: CdvPurchase.ErrorCode.VERIFICATION_FAILED,
|
|
647
647
|
message: err.message,
|
|
648
|
-
}, transient:
|
|
648
|
+
}, transient: true }, 'validator_exception');
|
|
649
649
|
}
|
|
650
650
|
});
|
|
651
651
|
receipts.forEach(receipt => this.runOnReceipt(receipt, onResponse));
|
|
@@ -2071,7 +2071,7 @@ var CdvPurchase;
|
|
|
2071
2071
|
/**
|
|
2072
2072
|
* Current release number of the plugin.
|
|
2073
2073
|
*/
|
|
2074
|
-
CdvPurchase.PLUGIN_VERSION = '13.
|
|
2074
|
+
CdvPurchase.PLUGIN_VERSION = '13.20.0';
|
|
2075
2075
|
/**
|
|
2076
2076
|
* Entry class of the plugin.
|
|
2077
2077
|
*/
|
|
@@ -8065,7 +8065,7 @@ var CdvPurchase;
|
|
|
8065
8065
|
this.products = [{ id: productId }];
|
|
8066
8066
|
this.transactionId = purchase.transactionId;
|
|
8067
8067
|
this.purchaseId = purchase.purchaseId;
|
|
8068
|
-
this.purchaseDate = new Date(purchase.purchaseDate);
|
|
8068
|
+
this.purchaseDate = purchase.purchaseDate ? new Date(purchase.purchaseDate) : undefined;
|
|
8069
8069
|
this.expirationDate = purchase.expirationDate ? new Date(purchase.expirationDate) : undefined;
|
|
8070
8070
|
this.lastRenewalDate = purchase.lastRenewalDate ? new Date(purchase.lastRenewalDate) : undefined;
|
|
8071
8071
|
this.renewalIntent = purchase.renewalIntent === 'Renew' ? CdvPurchase.RenewalIntent.RENEW : CdvPurchase.RenewalIntent.LAPSE;
|
|
@@ -8184,7 +8184,7 @@ var CdvPurchase;
|
|
|
8184
8184
|
billingPeriod: pp.billingPeriod,
|
|
8185
8185
|
paymentMode: pp.paymentMode,
|
|
8186
8186
|
recurrenceMode: pp.recurrenceMode,
|
|
8187
|
-
price: window.IapticJS.Utils.formatCurrency(pp.priceMicros, pp.currency) // Use Utils for formatting
|
|
8187
|
+
price: pp.currency ? window.IapticJS.Utils.formatCurrency(pp.priceMicros, pp.currency) : '' // Use Utils for formatting
|
|
8188
8188
|
})),
|
|
8189
8189
|
}, this.context.apiDecorators);
|
|
8190
8190
|
product.addOffer(offer);
|
|
@@ -9678,6 +9678,7 @@ var CdvPurchase;
|
|
|
9678
9678
|
this.latestReceipt = response.latest_receipt;
|
|
9679
9679
|
this.nativeTransactions = [response.transaction];
|
|
9680
9680
|
this.warning = response.warning;
|
|
9681
|
+
this.cache = response.cache;
|
|
9681
9682
|
this.validationDate = response.date ? new Date(response.date) : new Date();
|
|
9682
9683
|
Object.defineProperty(this, 'raw', { 'enumerable': false, get() { return response; } });
|
|
9683
9684
|
Object.defineProperty(this, 'finish', { 'enumerable': false, get() { return () => decorator.finish(this); } });
|
|
@@ -9699,6 +9700,7 @@ var CdvPurchase;
|
|
|
9699
9700
|
this.latestReceipt = response.latest_receipt;
|
|
9700
9701
|
this.nativeTransactions = [response.transaction];
|
|
9701
9702
|
this.warning = response.warning;
|
|
9703
|
+
this.cache = response.cache;
|
|
9702
9704
|
}
|
|
9703
9705
|
/** Finish all transactions in the receipt */
|
|
9704
9706
|
finish() {
|