expo-iap 3.1.38 → 3.2.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/.prettierignore +1 -0
- package/build/index.d.ts +15 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +30 -17
- package/build/index.js.map +1 -1
- package/build/types.d.ts +40 -8
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +2 -0
- package/build/useIAP.js.map +1 -1
- package/coverage/clover.xml +93 -91
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/src/index.html +14 -14
- package/coverage/lcov-report/src/index.ts.html +64 -25
- package/coverage/lcov-report/src/modules/android.ts.html +1 -1
- package/coverage/lcov-report/src/modules/index.html +1 -1
- package/coverage/lcov-report/src/modules/ios.ts.html +1 -1
- package/coverage/lcov-report/src/utils/debug.ts.html +1 -1
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +163 -158
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +30 -17
- package/src/types.ts +42 -9
- package/src/useIAP.ts +2 -0
package/coverage/lcov.info
CHANGED
|
@@ -29,20 +29,20 @@ FN:365,(anonymous_30)
|
|
|
29
29
|
FN:389,(anonymous_31)
|
|
30
30
|
FN:395,(anonymous_32)
|
|
31
31
|
FN:421,normalizeRequestProps
|
|
32
|
-
FN:
|
|
33
|
-
FN:
|
|
34
|
-
FN:
|
|
35
|
-
FN:
|
|
36
|
-
FN:
|
|
37
|
-
FN:
|
|
38
|
-
FN:
|
|
39
|
-
FN:
|
|
40
|
-
FN:
|
|
41
|
-
FN:
|
|
42
|
-
FN:
|
|
43
|
-
FN:
|
|
44
|
-
FN:
|
|
45
|
-
FN:
|
|
32
|
+
FN:475,(anonymous_34)
|
|
33
|
+
FN:612,(anonymous_35)
|
|
34
|
+
FN:629,(anonymous_36)
|
|
35
|
+
FN:672,(anonymous_37)
|
|
36
|
+
FN:674,(anonymous_38)
|
|
37
|
+
FN:703,(anonymous_39)
|
|
38
|
+
FN:727,(anonymous_40)
|
|
39
|
+
FN:768,(anonymous_41)
|
|
40
|
+
FN:805,(anonymous_42)
|
|
41
|
+
FN:815,(anonymous_43)
|
|
42
|
+
FN:816,(anonymous_44)
|
|
43
|
+
FN:817,(anonymous_45)
|
|
44
|
+
FN:818,(anonymous_46)
|
|
45
|
+
FN:824,(anonymous_47)
|
|
46
46
|
FNF:43
|
|
47
47
|
FNH:34
|
|
48
48
|
FNDA:2,(anonymous_5)
|
|
@@ -202,99 +202,101 @@ DA:395,2
|
|
|
202
202
|
DA:396,2
|
|
203
203
|
DA:397,0
|
|
204
204
|
DA:399,2
|
|
205
|
-
DA:
|
|
206
|
-
DA:
|
|
207
|
-
DA:
|
|
208
|
-
DA:
|
|
209
|
-
DA:
|
|
210
|
-
DA:
|
|
211
|
-
DA:
|
|
212
|
-
DA:
|
|
213
|
-
DA:
|
|
214
|
-
DA:
|
|
215
|
-
DA:
|
|
216
|
-
DA:
|
|
217
|
-
DA:
|
|
218
|
-
DA:
|
|
219
|
-
DA:
|
|
220
|
-
DA:
|
|
221
|
-
DA:
|
|
222
|
-
DA:
|
|
223
|
-
DA:513,6
|
|
224
|
-
DA:514,5
|
|
225
|
-
DA:515,2
|
|
205
|
+
DA:429,10
|
|
206
|
+
DA:430,6
|
|
207
|
+
DA:432,4
|
|
208
|
+
DA:475,2
|
|
209
|
+
DA:478,13
|
|
210
|
+
DA:479,13
|
|
211
|
+
DA:480,12
|
|
212
|
+
DA:482,12
|
|
213
|
+
DA:483,6
|
|
214
|
+
DA:485,6
|
|
215
|
+
DA:486,1
|
|
216
|
+
DA:500,5
|
|
217
|
+
DA:501,1
|
|
218
|
+
DA:504,4
|
|
219
|
+
DA:510,4
|
|
220
|
+
DA:515,4
|
|
221
|
+
DA:516,1
|
|
222
|
+
DA:519,3
|
|
226
223
|
DA:520,2
|
|
227
|
-
DA:
|
|
228
|
-
DA:
|
|
229
|
-
DA:
|
|
224
|
+
DA:523,1
|
|
225
|
+
DA:526,6
|
|
226
|
+
DA:527,5
|
|
227
|
+
DA:528,2
|
|
228
|
+
DA:533,2
|
|
229
|
+
DA:534,1
|
|
230
230
|
DA:553,1
|
|
231
|
-
DA:
|
|
232
|
-
DA:
|
|
233
|
-
DA:
|
|
234
|
-
DA:
|
|
235
|
-
DA:
|
|
236
|
-
DA:
|
|
237
|
-
DA:
|
|
238
|
-
DA:
|
|
239
|
-
DA:
|
|
240
|
-
DA:
|
|
241
|
-
DA:
|
|
242
|
-
DA:
|
|
243
|
-
DA:
|
|
244
|
-
DA:
|
|
245
|
-
DA:
|
|
246
|
-
DA:
|
|
247
|
-
DA:
|
|
248
|
-
DA:
|
|
249
|
-
DA:
|
|
250
|
-
DA:
|
|
251
|
-
DA:
|
|
252
|
-
DA:
|
|
253
|
-
DA:638,1
|
|
254
|
-
DA:639,1
|
|
231
|
+
DA:555,1
|
|
232
|
+
DA:566,1
|
|
233
|
+
DA:569,3
|
|
234
|
+
DA:570,2
|
|
235
|
+
DA:575,2
|
|
236
|
+
DA:576,1
|
|
237
|
+
DA:598,1
|
|
238
|
+
DA:600,1
|
|
239
|
+
DA:601,1
|
|
240
|
+
DA:602,1
|
|
241
|
+
DA:604,1
|
|
242
|
+
DA:612,1
|
|
243
|
+
DA:618,1
|
|
244
|
+
DA:621,1
|
|
245
|
+
DA:626,1
|
|
246
|
+
DA:629,2
|
|
247
|
+
DA:633,6
|
|
248
|
+
DA:634,2
|
|
249
|
+
DA:635,2
|
|
250
|
+
DA:638,4
|
|
251
|
+
DA:639,3
|
|
252
|
+
DA:641,3
|
|
255
253
|
DA:642,1
|
|
256
|
-
DA:
|
|
257
|
-
DA:
|
|
258
|
-
DA:
|
|
259
|
-
DA:
|
|
260
|
-
DA:
|
|
261
|
-
DA:
|
|
262
|
-
DA:
|
|
263
|
-
DA:
|
|
264
|
-
DA:
|
|
265
|
-
DA:
|
|
266
|
-
DA:
|
|
267
|
-
DA:
|
|
268
|
-
DA:
|
|
269
|
-
DA:
|
|
270
|
-
DA:
|
|
271
|
-
DA:
|
|
272
|
-
DA:
|
|
273
|
-
DA:
|
|
274
|
-
DA:
|
|
275
|
-
DA:
|
|
276
|
-
DA:
|
|
277
|
-
DA:
|
|
278
|
-
DA:
|
|
254
|
+
DA:650,2
|
|
255
|
+
DA:651,1
|
|
256
|
+
DA:652,1
|
|
257
|
+
DA:655,1
|
|
258
|
+
DA:656,1
|
|
259
|
+
DA:659,1
|
|
260
|
+
DA:672,2
|
|
261
|
+
DA:673,1
|
|
262
|
+
DA:674,1
|
|
263
|
+
DA:677,1
|
|
264
|
+
DA:701,2
|
|
265
|
+
DA:703,2
|
|
266
|
+
DA:704,5
|
|
267
|
+
DA:705,1
|
|
268
|
+
DA:706,1
|
|
269
|
+
DA:709,4
|
|
270
|
+
DA:710,3
|
|
271
|
+
DA:711,1
|
|
272
|
+
DA:714,1
|
|
273
|
+
DA:727,2
|
|
274
|
+
DA:730,4
|
|
275
|
+
DA:732,4
|
|
276
|
+
DA:733,1
|
|
277
|
+
DA:736,3
|
|
278
|
+
DA:737,2
|
|
279
279
|
DA:743,1
|
|
280
|
-
DA:
|
|
281
|
-
DA:
|
|
282
|
-
DA:
|
|
283
|
-
DA:
|
|
284
|
-
DA:
|
|
285
|
-
DA:
|
|
286
|
-
DA:793,13
|
|
287
|
-
DA:794,12
|
|
288
|
-
DA:797,1
|
|
289
|
-
DA:800,2
|
|
290
|
-
DA:801,2
|
|
291
|
-
DA:802,2
|
|
280
|
+
DA:747,1
|
|
281
|
+
DA:756,1
|
|
282
|
+
DA:768,2
|
|
283
|
+
DA:771,3
|
|
284
|
+
DA:772,2
|
|
285
|
+
DA:775,1
|
|
292
286
|
DA:803,2
|
|
293
|
-
DA:804,2
|
|
294
287
|
DA:805,2
|
|
295
|
-
DA:
|
|
296
|
-
|
|
297
|
-
|
|
288
|
+
DA:806,13
|
|
289
|
+
DA:807,12
|
|
290
|
+
DA:810,1
|
|
291
|
+
DA:813,2
|
|
292
|
+
DA:814,2
|
|
293
|
+
DA:815,2
|
|
294
|
+
DA:816,2
|
|
295
|
+
DA:817,2
|
|
296
|
+
DA:818,2
|
|
297
|
+
DA:824,2
|
|
298
|
+
LF:207
|
|
299
|
+
LH:201
|
|
298
300
|
BRDA:51,0,0,2
|
|
299
301
|
BRDA:51,0,1,2
|
|
300
302
|
BRDA:81,1,0,2
|
|
@@ -345,63 +347,66 @@ BRDA:391,29,1,6
|
|
|
345
347
|
BRDA:396,30,0,0
|
|
346
348
|
BRDA:396,31,0,2
|
|
347
349
|
BRDA:396,31,1,2
|
|
348
|
-
BRDA:
|
|
349
|
-
BRDA:
|
|
350
|
-
BRDA:
|
|
351
|
-
BRDA:
|
|
352
|
-
BRDA:
|
|
353
|
-
BRDA:
|
|
354
|
-
BRDA:
|
|
355
|
-
BRDA:
|
|
356
|
-
BRDA:
|
|
357
|
-
BRDA:
|
|
358
|
-
BRDA:
|
|
359
|
-
BRDA:
|
|
360
|
-
BRDA:
|
|
361
|
-
BRDA:
|
|
362
|
-
BRDA:
|
|
363
|
-
BRDA:
|
|
364
|
-
BRDA:
|
|
365
|
-
BRDA:
|
|
366
|
-
BRDA:
|
|
367
|
-
BRDA:
|
|
368
|
-
BRDA:
|
|
369
|
-
BRDA:
|
|
370
|
-
BRDA:
|
|
371
|
-
BRDA:
|
|
372
|
-
BRDA:
|
|
373
|
-
BRDA:
|
|
374
|
-
BRDA:
|
|
375
|
-
BRDA:602,
|
|
376
|
-
BRDA:
|
|
377
|
-
BRDA:
|
|
378
|
-
BRDA:
|
|
379
|
-
BRDA:
|
|
380
|
-
BRDA:
|
|
381
|
-
BRDA:
|
|
382
|
-
BRDA:
|
|
383
|
-
BRDA:
|
|
384
|
-
BRDA:
|
|
385
|
-
BRDA:
|
|
386
|
-
BRDA:
|
|
387
|
-
BRDA:
|
|
388
|
-
BRDA:
|
|
389
|
-
BRDA:
|
|
390
|
-
BRDA:
|
|
391
|
-
BRDA:
|
|
392
|
-
BRDA:
|
|
393
|
-
BRDA:
|
|
394
|
-
BRDA:
|
|
395
|
-
BRDA:
|
|
396
|
-
BRDA:
|
|
397
|
-
BRDA:
|
|
398
|
-
BRDA:
|
|
399
|
-
BRDA:
|
|
400
|
-
BRDA:
|
|
401
|
-
BRDA:
|
|
402
|
-
BRDA:
|
|
403
|
-
|
|
404
|
-
|
|
350
|
+
BRDA:429,32,0,6
|
|
351
|
+
BRDA:430,33,0,6
|
|
352
|
+
BRDA:430,33,1,6
|
|
353
|
+
BRDA:432,34,0,4
|
|
354
|
+
BRDA:432,34,1,4
|
|
355
|
+
BRDA:482,35,0,6
|
|
356
|
+
BRDA:485,36,0,1
|
|
357
|
+
BRDA:500,37,0,1
|
|
358
|
+
BRDA:500,38,0,5
|
|
359
|
+
BRDA:500,38,1,3
|
|
360
|
+
BRDA:505,39,0,2
|
|
361
|
+
BRDA:505,39,1,2
|
|
362
|
+
BRDA:515,40,0,1
|
|
363
|
+
BRDA:519,41,0,2
|
|
364
|
+
BRDA:523,42,0,1
|
|
365
|
+
BRDA:523,42,1,0
|
|
366
|
+
BRDA:526,43,0,5
|
|
367
|
+
BRDA:527,44,0,2
|
|
368
|
+
BRDA:533,45,0,1
|
|
369
|
+
BRDA:563,46,0,1
|
|
370
|
+
BRDA:563,46,1,1
|
|
371
|
+
BRDA:569,47,0,2
|
|
372
|
+
BRDA:575,48,0,1
|
|
373
|
+
BRDA:600,49,0,1
|
|
374
|
+
BRDA:600,49,1,0
|
|
375
|
+
BRDA:601,50,0,1
|
|
376
|
+
BRDA:601,50,1,1
|
|
377
|
+
BRDA:602,51,0,1
|
|
378
|
+
BRDA:602,51,1,1
|
|
379
|
+
BRDA:615,52,0,1
|
|
380
|
+
BRDA:615,52,1,1
|
|
381
|
+
BRDA:631,53,0,3
|
|
382
|
+
BRDA:633,54,0,2
|
|
383
|
+
BRDA:638,55,0,3
|
|
384
|
+
BRDA:639,56,0,3
|
|
385
|
+
BRDA:639,56,1,1
|
|
386
|
+
BRDA:641,57,0,1
|
|
387
|
+
BRDA:650,58,0,1
|
|
388
|
+
BRDA:673,59,0,1
|
|
389
|
+
BRDA:704,60,0,1
|
|
390
|
+
BRDA:709,61,0,3
|
|
391
|
+
BRDA:710,62,0,3
|
|
392
|
+
BRDA:710,62,1,0
|
|
393
|
+
BRDA:732,63,0,1
|
|
394
|
+
BRDA:736,64,0,2
|
|
395
|
+
BRDA:737,65,0,1
|
|
396
|
+
BRDA:738,66,0,2
|
|
397
|
+
BRDA:738,66,1,2
|
|
398
|
+
BRDA:738,66,2,1
|
|
399
|
+
BRDA:738,66,3,1
|
|
400
|
+
BRDA:752,67,0,1
|
|
401
|
+
BRDA:752,67,1,0
|
|
402
|
+
BRDA:771,68,0,2
|
|
403
|
+
BRDA:771,69,0,3
|
|
404
|
+
BRDA:771,69,1,2
|
|
405
|
+
BRDA:806,70,0,12
|
|
406
|
+
BRDA:806,71,0,13
|
|
407
|
+
BRDA:806,71,1,2
|
|
408
|
+
BRF:108
|
|
409
|
+
BRH:98
|
|
405
410
|
end_of_record
|
|
406
411
|
TN:
|
|
407
412
|
SF:src/modules/android.ts
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -424,24 +424,28 @@ function normalizeRequestProps(
|
|
|
424
424
|
| RequestSubscriptionPropsByPlatforms,
|
|
425
425
|
platform: 'ios' | 'android',
|
|
426
426
|
) {
|
|
427
|
-
//
|
|
428
|
-
|
|
427
|
+
// Support both new (apple/google) and legacy (ios/android) field names
|
|
428
|
+
// New fields take precedence over deprecated ones
|
|
429
|
+
if (platform === 'ios') {
|
|
430
|
+
return request.apple ?? request.ios;
|
|
431
|
+
}
|
|
432
|
+
return request.google ?? request.android;
|
|
429
433
|
}
|
|
430
434
|
|
|
431
435
|
/**
|
|
432
436
|
* Request a purchase for products or subscriptions.
|
|
433
437
|
*
|
|
434
438
|
* @param requestObj - Purchase request configuration
|
|
435
|
-
* @param requestObj.request -
|
|
439
|
+
* @param requestObj.request - Store-specific purchase parameters
|
|
436
440
|
* @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions
|
|
437
441
|
*
|
|
438
442
|
* @example
|
|
439
443
|
* ```typescript
|
|
440
|
-
* // Product purchase
|
|
444
|
+
* // Product purchase (recommended: use apple/google)
|
|
441
445
|
* await requestPurchase({
|
|
442
446
|
* request: {
|
|
443
|
-
*
|
|
444
|
-
*
|
|
447
|
+
* apple: { sku: productId },
|
|
448
|
+
* google: { skus: [productId] }
|
|
445
449
|
* },
|
|
446
450
|
* type: 'in-app'
|
|
447
451
|
* });
|
|
@@ -449,14 +453,23 @@ function normalizeRequestProps(
|
|
|
449
453
|
* // Subscription purchase
|
|
450
454
|
* await requestPurchase({
|
|
451
455
|
* request: {
|
|
452
|
-
*
|
|
453
|
-
*
|
|
456
|
+
* apple: { sku: subscriptionId },
|
|
457
|
+
* google: {
|
|
454
458
|
* skus: [subscriptionId],
|
|
455
459
|
* subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]
|
|
456
460
|
* }
|
|
457
461
|
* },
|
|
458
462
|
* type: 'subs'
|
|
459
463
|
* });
|
|
464
|
+
*
|
|
465
|
+
* // Legacy format (deprecated, but still supported)
|
|
466
|
+
* await requestPurchase({
|
|
467
|
+
* request: {
|
|
468
|
+
* ios: { sku: productId },
|
|
469
|
+
* android: { skus: [productId] }
|
|
470
|
+
* },
|
|
471
|
+
* type: 'in-app'
|
|
472
|
+
* });
|
|
460
473
|
* ```
|
|
461
474
|
*/
|
|
462
475
|
export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
@@ -471,12 +484,12 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
471
484
|
|
|
472
485
|
if (!normalizedRequest?.sku) {
|
|
473
486
|
throw new Error(
|
|
474
|
-
'Invalid request for
|
|
487
|
+
'Invalid request for Apple. The `sku` property is required and must be a string.\n\n' +
|
|
475
488
|
'Expected format:\n' +
|
|
476
489
|
' requestPurchase({\n' +
|
|
477
490
|
' request: {\n' +
|
|
478
|
-
'
|
|
479
|
-
'
|
|
491
|
+
' apple: { sku: "product_id" },\n' +
|
|
492
|
+
' google: { skus: ["product_id"] }\n' +
|
|
480
493
|
' },\n' +
|
|
481
494
|
' type: "in-app"\n' +
|
|
482
495
|
' })\n\n' +
|
|
@@ -519,12 +532,12 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
519
532
|
|
|
520
533
|
if (!normalizedRequest?.skus?.length) {
|
|
521
534
|
throw new Error(
|
|
522
|
-
'Invalid request for
|
|
535
|
+
'Invalid request for Google. The `skus` property is required and must be a non-empty array.\n\n' +
|
|
523
536
|
'Expected format:\n' +
|
|
524
537
|
' requestPurchase({\n' +
|
|
525
538
|
' request: {\n' +
|
|
526
|
-
'
|
|
527
|
-
'
|
|
539
|
+
' apple: { sku: "product_id" },\n' +
|
|
540
|
+
' google: { skus: ["product_id"] }\n' +
|
|
528
541
|
' },\n' +
|
|
529
542
|
' type: "in-app"\n' +
|
|
530
543
|
' })\n\n' +
|
|
@@ -561,12 +574,12 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
561
574
|
|
|
562
575
|
if (!normalizedRequest?.skus?.length) {
|
|
563
576
|
throw new Error(
|
|
564
|
-
'Invalid request for
|
|
577
|
+
'Invalid request for Google. The `skus` property is required and must be a non-empty array.\n\n' +
|
|
565
578
|
'Expected format:\n' +
|
|
566
579
|
' requestPurchase({\n' +
|
|
567
580
|
' request: {\n' +
|
|
568
|
-
'
|
|
569
|
-
'
|
|
581
|
+
' apple: { sku: "subscription_id" },\n' +
|
|
582
|
+
' google: { skus: ["subscription_id"] }\n' +
|
|
570
583
|
' },\n' +
|
|
571
584
|
' type: "subs"\n' +
|
|
572
585
|
' })\n\n' +
|
package/src/types.ts
CHANGED
|
@@ -180,11 +180,11 @@ export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product
|
|
|
180
180
|
|
|
181
181
|
export type IapPlatform = 'ios' | 'android';
|
|
182
182
|
|
|
183
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
184
|
+
|
|
183
185
|
/** Unified purchase states from IAPKit verification response. */
|
|
184
186
|
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
|
|
185
187
|
|
|
186
|
-
export type IapkitStore = 'apple' | 'google';
|
|
187
|
-
|
|
188
188
|
/** Connection initialization configuration */
|
|
189
189
|
export interface InitConnectionConfig {
|
|
190
190
|
/**
|
|
@@ -457,12 +457,18 @@ export interface PurchaseAndroid extends PurchaseCommon {
|
|
|
457
457
|
obfuscatedAccountIdAndroid?: (string | null);
|
|
458
458
|
obfuscatedProfileIdAndroid?: (string | null);
|
|
459
459
|
packageNameAndroid?: (string | null);
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated Use store instead
|
|
462
|
+
* @deprecated Use store instead
|
|
463
|
+
*/
|
|
460
464
|
platform: IapPlatform;
|
|
461
465
|
productId: string;
|
|
462
466
|
purchaseState: PurchaseState;
|
|
463
467
|
purchaseToken?: (string | null);
|
|
464
468
|
quantity: number;
|
|
465
469
|
signatureAndroid?: (string | null);
|
|
470
|
+
/** Store where purchase was made */
|
|
471
|
+
store: IapStore;
|
|
466
472
|
transactionDate: number;
|
|
467
473
|
transactionId?: (string | null);
|
|
468
474
|
}
|
|
@@ -478,12 +484,18 @@ export interface PurchaseCommon {
|
|
|
478
484
|
id: string;
|
|
479
485
|
ids?: (string[] | null);
|
|
480
486
|
isAutoRenewing: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* @deprecated Use store instead
|
|
489
|
+
* @deprecated Use store instead
|
|
490
|
+
*/
|
|
481
491
|
platform: IapPlatform;
|
|
482
492
|
productId: string;
|
|
483
493
|
purchaseState: PurchaseState;
|
|
484
494
|
/** Unified purchase token (iOS JWS, Android purchaseToken) */
|
|
485
495
|
purchaseToken?: (string | null);
|
|
486
496
|
quantity: number;
|
|
497
|
+
/** Store where purchase was made */
|
|
498
|
+
store: IapStore;
|
|
487
499
|
transactionDate: number;
|
|
488
500
|
}
|
|
489
501
|
|
|
@@ -510,6 +522,10 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
510
522
|
originalTransactionDateIOS?: (number | null);
|
|
511
523
|
originalTransactionIdentifierIOS?: (string | null);
|
|
512
524
|
ownershipTypeIOS?: (string | null);
|
|
525
|
+
/**
|
|
526
|
+
* @deprecated Use store instead
|
|
527
|
+
* @deprecated Use store instead
|
|
528
|
+
*/
|
|
513
529
|
platform: IapPlatform;
|
|
514
530
|
productId: string;
|
|
515
531
|
purchaseState: PurchaseState;
|
|
@@ -521,6 +537,8 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
521
537
|
renewalInfoIOS?: (RenewalInfoIOS | null);
|
|
522
538
|
revocationDateIOS?: (number | null);
|
|
523
539
|
revocationReasonIOS?: (string | null);
|
|
540
|
+
/** Store where purchase was made */
|
|
541
|
+
store: IapStore;
|
|
524
542
|
storefrontCountryCodeIOS?: (string | null);
|
|
525
543
|
subscriptionGroupIdIOS?: (string | null);
|
|
526
544
|
transactionDate: number;
|
|
@@ -710,9 +728,13 @@ export type RequestPurchaseProps =
|
|
|
710
728
|
};
|
|
711
729
|
|
|
712
730
|
export interface RequestPurchasePropsByPlatforms {
|
|
713
|
-
/**
|
|
731
|
+
/** @deprecated Use google instead */
|
|
714
732
|
android?: (RequestPurchaseAndroidProps | null);
|
|
715
|
-
/**
|
|
733
|
+
/** Apple-specific purchase parameters */
|
|
734
|
+
apple?: (RequestPurchaseIosProps | null);
|
|
735
|
+
/** Google-specific purchase parameters */
|
|
736
|
+
google?: (RequestPurchaseAndroidProps | null);
|
|
737
|
+
/** @deprecated Use apple instead */
|
|
716
738
|
ios?: (RequestPurchaseIosProps | null);
|
|
717
739
|
}
|
|
718
740
|
|
|
@@ -744,9 +766,13 @@ export interface RequestSubscriptionIosProps {
|
|
|
744
766
|
}
|
|
745
767
|
|
|
746
768
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
747
|
-
/**
|
|
769
|
+
/** @deprecated Use google instead */
|
|
748
770
|
android?: (RequestSubscriptionAndroidProps | null);
|
|
749
|
-
/**
|
|
771
|
+
/** Apple-specific subscription parameters */
|
|
772
|
+
apple?: (RequestSubscriptionIosProps | null);
|
|
773
|
+
/** Google-specific subscription parameters */
|
|
774
|
+
google?: (RequestSubscriptionAndroidProps | null);
|
|
775
|
+
/** @deprecated Use apple instead */
|
|
750
776
|
ios?: (RequestSubscriptionIosProps | null);
|
|
751
777
|
}
|
|
752
778
|
|
|
@@ -774,7 +800,7 @@ export interface RequestVerifyPurchaseWithIapkitResult {
|
|
|
774
800
|
isValid: boolean;
|
|
775
801
|
/** The current state of the purchase. */
|
|
776
802
|
state: IapkitPurchaseState;
|
|
777
|
-
store:
|
|
803
|
+
store: IapStore;
|
|
778
804
|
}
|
|
779
805
|
|
|
780
806
|
export interface Subscription {
|
|
@@ -882,14 +908,21 @@ export interface VerifyPurchaseResultIOS {
|
|
|
882
908
|
receiptData: string;
|
|
883
909
|
}
|
|
884
910
|
|
|
911
|
+
export interface VerifyPurchaseWithProviderError {
|
|
912
|
+
code?: (string | null);
|
|
913
|
+
message: string;
|
|
914
|
+
}
|
|
915
|
+
|
|
885
916
|
export interface VerifyPurchaseWithProviderProps {
|
|
886
917
|
iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);
|
|
887
918
|
provider: PurchaseVerificationProvider;
|
|
888
919
|
}
|
|
889
920
|
|
|
890
921
|
export interface VerifyPurchaseWithProviderResult {
|
|
891
|
-
/**
|
|
892
|
-
|
|
922
|
+
/** Error details if verification failed */
|
|
923
|
+
errors?: (VerifyPurchaseWithProviderError[] | null);
|
|
924
|
+
/** IAPKit verification result */
|
|
925
|
+
iapkit?: (RequestVerifyPurchaseWithIapkitResult | null);
|
|
893
926
|
provider: PurchaseVerificationProvider;
|
|
894
927
|
}
|
|
895
928
|
|
package/src/useIAP.ts
CHANGED
|
@@ -203,7 +203,9 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
203
203
|
purchaseState: purchase.purchaseState,
|
|
204
204
|
purchaseToken: purchase.purchaseToken ?? null,
|
|
205
205
|
quantity: purchase.quantity,
|
|
206
|
+
store: purchase.store,
|
|
206
207
|
transactionDate: purchase.transactionDate,
|
|
208
|
+
transactionId: purchase.transactionId,
|
|
207
209
|
}),
|
|
208
210
|
[],
|
|
209
211
|
);
|