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.
@@ -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:462,(anonymous_34)
33
- FN:599,(anonymous_35)
34
- FN:616,(anonymous_36)
35
- FN:659,(anonymous_37)
36
- FN:661,(anonymous_38)
37
- FN:690,(anonymous_39)
38
- FN:714,(anonymous_40)
39
- FN:755,(anonymous_41)
40
- FN:792,(anonymous_42)
41
- FN:802,(anonymous_43)
42
- FN:803,(anonymous_44)
43
- FN:804,(anonymous_45)
44
- FN:805,(anonymous_46)
45
- FN:811,(anonymous_47)
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:428,10
206
- DA:462,2
207
- DA:465,13
208
- DA:466,13
209
- DA:467,12
210
- DA:469,12
211
- DA:470,6
212
- DA:472,6
213
- DA:473,1
214
- DA:487,5
215
- DA:488,1
216
- DA:491,4
217
- DA:497,4
218
- DA:502,4
219
- DA:503,1
220
- DA:506,3
221
- DA:507,2
222
- DA:510,1
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:521,1
228
- DA:540,1
229
- DA:542,1
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:556,3
232
- DA:557,2
233
- DA:562,2
234
- DA:563,1
235
- DA:585,1
236
- DA:587,1
237
- DA:588,1
238
- DA:589,1
239
- DA:591,1
240
- DA:599,1
241
- DA:605,1
242
- DA:608,1
243
- DA:613,1
244
- DA:616,2
245
- DA:620,6
246
- DA:621,2
247
- DA:622,2
248
- DA:625,4
249
- DA:626,3
250
- DA:628,3
251
- DA:629,1
252
- DA:637,2
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:643,1
257
- DA:646,1
258
- DA:659,2
259
- DA:660,1
260
- DA:661,1
261
- DA:664,1
262
- DA:688,2
263
- DA:690,2
264
- DA:691,5
265
- DA:692,1
266
- DA:693,1
267
- DA:696,4
268
- DA:697,3
269
- DA:698,1
270
- DA:701,1
271
- DA:714,2
272
- DA:717,4
273
- DA:719,4
274
- DA:720,1
275
- DA:723,3
276
- DA:724,2
277
- DA:730,1
278
- DA:734,1
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:755,2
281
- DA:758,3
282
- DA:759,2
283
- DA:762,1
284
- DA:790,2
285
- DA:792,2
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:811,2
296
- LF:205
297
- LH:199
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:428,32,0,6
349
- BRDA:428,32,1,4
350
- BRDA:469,33,0,6
351
- BRDA:472,34,0,1
352
- BRDA:487,35,0,1
353
- BRDA:487,36,0,5
354
- BRDA:487,36,1,3
355
- BRDA:492,37,0,2
356
- BRDA:492,37,1,2
357
- BRDA:502,38,0,1
358
- BRDA:506,39,0,2
359
- BRDA:510,40,0,1
360
- BRDA:510,40,1,0
361
- BRDA:513,41,0,5
362
- BRDA:514,42,0,2
363
- BRDA:520,43,0,1
364
- BRDA:550,44,0,1
365
- BRDA:550,44,1,1
366
- BRDA:556,45,0,2
367
- BRDA:562,46,0,1
368
- BRDA:587,47,0,1
369
- BRDA:587,47,1,0
370
- BRDA:588,48,0,1
371
- BRDA:588,48,1,1
372
- BRDA:589,49,0,1
373
- BRDA:589,49,1,1
374
- BRDA:602,50,0,1
375
- BRDA:602,50,1,1
376
- BRDA:618,51,0,3
377
- BRDA:620,52,0,2
378
- BRDA:625,53,0,3
379
- BRDA:626,54,0,3
380
- BRDA:626,54,1,1
381
- BRDA:628,55,0,1
382
- BRDA:637,56,0,1
383
- BRDA:660,57,0,1
384
- BRDA:691,58,0,1
385
- BRDA:696,59,0,3
386
- BRDA:697,60,0,3
387
- BRDA:697,60,1,0
388
- BRDA:719,61,0,1
389
- BRDA:723,62,0,2
390
- BRDA:724,63,0,1
391
- BRDA:725,64,0,2
392
- BRDA:725,64,1,2
393
- BRDA:725,64,2,1
394
- BRDA:725,64,3,1
395
- BRDA:739,65,0,1
396
- BRDA:739,65,1,0
397
- BRDA:758,66,0,2
398
- BRDA:758,67,0,3
399
- BRDA:758,67,1,2
400
- BRDA:793,68,0,12
401
- BRDA:793,69,0,13
402
- BRDA:793,69,1,2
403
- BRF:105
404
- BRH:95
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
@@ -1,5 +1,5 @@
1
1
  {
2
- "apple": "1.2.42",
3
- "google": "1.3.8",
4
- "gql": "1.2.7"
2
+ "apple": "1.3.0",
3
+ "google": "1.3.10",
4
+ "gql": "1.3.0"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "3.1.38",
3
+ "version": "3.2.0",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/src/index.ts CHANGED
@@ -424,24 +424,28 @@ function normalizeRequestProps(
424
424
  | RequestSubscriptionPropsByPlatforms,
425
425
  platform: 'ios' | 'android',
426
426
  ) {
427
- // Platform-specific format - directly return the appropriate platform data
428
- return platform === 'ios' ? request.ios : request.android;
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 - Platform-specific purchase parameters
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
- * ios: { sku: productId },
444
- * android: { skus: [productId] }
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
- * ios: { sku: subscriptionId },
453
- * android: {
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 iOS. The `sku` property is required and must be a string.\n\n' +
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
- ' android: { skus: ["product_id"] },\n' +
479
- ' ios: { sku: "product_id" }\n' +
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 Android. The `skus` property is required and must be a non-empty array.\n\n' +
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
- ' android: { skus: ["product_id"] },\n' +
527
- ' ios: { sku: "product_id" }\n' +
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 Android. The `skus` property is required and must be a non-empty array.\n\n' +
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
- ' android: { skus: ["subscription_id"] },\n' +
569
- ' ios: { sku: "subscription_id" }\n' +
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
- /** Android-specific purchase parameters */
731
+ /** @deprecated Use google instead */
714
732
  android?: (RequestPurchaseAndroidProps | null);
715
- /** iOS-specific purchase parameters */
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
- /** Android-specific subscription parameters */
769
+ /** @deprecated Use google instead */
748
770
  android?: (RequestSubscriptionAndroidProps | null);
749
- /** iOS-specific subscription parameters */
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: IapkitStore;
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
- /** IAPKit verification results (can include Apple and Google entries) */
892
- iapkit: RequestVerifyPurchaseWithIapkitResult[];
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
  );