@stripe/stripe-react-native 0.69.0 → 0.71.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.
Files changed (57) hide show
  1. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +8 -0
  2. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +9 -8
  3. package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +8 -0
  4. package/android/src/onramp/java/com/reactnativestripesdk/OnrampErrors.kt +22 -8
  5. package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +48 -0
  6. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +62 -0
  7. package/android/src/test/java/com/reactnativestripesdk/OnrampErrorsTest.kt +103 -26
  8. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +10 -0
  9. package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +37 -0
  10. package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentMethodMappersTest.kt +110 -0
  11. package/ios/Mappers.swift +21 -0
  12. package/ios/OnrampErrors.swift +23 -8
  13. package/ios/PaymentMethodFactory.swift +9 -0
  14. package/ios/StripeOnrampSdk.mm +16 -0
  15. package/ios/StripeSdkImpl.swift +56 -0
  16. package/jest/setup.js +2 -0
  17. package/lib/commonjs/components/StripeProvider.js +1 -1
  18. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  19. package/lib/commonjs/hooks/useOnramp.js +1 -1
  20. package/lib/commonjs/hooks/useOnramp.js.map +1 -1
  21. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
  22. package/lib/commonjs/types/Onramp.js +1 -1
  23. package/lib/commonjs/types/Onramp.js.map +1 -1
  24. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  25. package/lib/module/components/StripeProvider.js +1 -1
  26. package/lib/module/components/StripeProvider.js.map +1 -1
  27. package/lib/module/hooks/useOnramp.js +1 -1
  28. package/lib/module/hooks/useOnramp.js.map +1 -1
  29. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
  30. package/lib/module/types/Onramp.js +1 -1
  31. package/lib/module/types/Onramp.js.map +1 -1
  32. package/lib/module/types/PaymentIntent.js.map +1 -1
  33. package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
  34. package/lib/typescript/src/hooks/useOnramp.d.ts +18 -0
  35. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
  36. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +2 -0
  37. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
  38. package/lib/typescript/src/types/Onramp.d.ts +84 -10
  39. package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
  40. package/lib/typescript/src/types/PaymentIntent.d.ts +9 -1
  41. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  42. package/lib/typescript/src/types/PaymentMethod.d.ts +1 -1
  43. package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/components/StripeProvider.tsx +0 -2
  46. package/src/hooks/useOnramp.tsx +50 -83
  47. package/src/specs/NativeOnrampSdkModule.ts +8 -0
  48. package/src/types/Onramp.ts +100 -9
  49. package/src/types/PaymentIntent.ts +11 -1
  50. package/src/types/PaymentMethod.ts +1 -0
  51. package/lib/commonjs/internal/stripeConfig.js +0 -2
  52. package/lib/commonjs/internal/stripeConfig.js.map +0 -1
  53. package/lib/module/internal/stripeConfig.js +0 -2
  54. package/lib/module/internal/stripeConfig.js.map +0 -1
  55. package/lib/typescript/src/internal/stripeConfig.d.ts +0 -3
  56. package/lib/typescript/src/internal/stripeConfig.d.ts.map +0 -1
  57. package/src/internal/stripeConfig.ts +0 -9
@@ -6,9 +6,9 @@ import type {
6
6
  } from './PlatformPay';
7
7
 
8
8
  /**
9
- * Generic error codes returned by Crypto Onramp APIs.
9
+ * Generic error statuses returned by Crypto Onramp APIs.
10
10
  */
11
- export enum OnrampError {
11
+ export enum OnrampErrorStatus {
12
12
  Failed = 'Failed',
13
13
  Canceled = 'Canceled',
14
14
  Unknown = 'Unknown',
@@ -175,8 +175,39 @@ export enum CryptoNetwork {
175
175
  worldchain = 'worldchain',
176
176
  xrpl = 'xrpl',
177
177
  sui = 'sui',
178
+ arbitrum = 'arbitrum',
178
179
  }
179
180
 
181
+ /**
182
+ * A short-lived server-issued challenge used to prove ownership of a registered wallet.
183
+ */
184
+ export type WalletOwnershipChallenge = {
185
+ /** Opaque identifier for this challenge. */
186
+ challengeId: string;
187
+ /** The wallet address bound to this challenge. */
188
+ walletAddress: string;
189
+ /** The crypto network bound to this challenge. */
190
+ network: CryptoNetwork;
191
+ /** The exact opaque message the wallet must sign. */
192
+ message: string;
193
+ /** ISO 8601 timestamp indicating when this challenge expires. */
194
+ expiresAt: string;
195
+ };
196
+
197
+ /**
198
+ * A registered crypto consumer wallet.
199
+ */
200
+ export type CryptoConsumerWallet = {
201
+ /** The consumer wallet's unique identifier. */
202
+ id: string;
203
+ /** The registered wallet address. */
204
+ walletAddress: string;
205
+ /** The crypto network for the registered wallet. */
206
+ network: CryptoNetwork;
207
+ /** Whether ownership of this wallet has been verified. */
208
+ verifiedOwnership: boolean;
209
+ };
210
+
180
211
  /**
181
212
  * Represents a calendar date using day, month, and year components.
182
213
  * Example: March 31st, 1975 -> { day: 31, month: 3, year: 1975 }
@@ -268,23 +299,43 @@ export type ComplianceIdentifierRequirements = {
268
299
  carfTinRequired: boolean;
269
300
  };
270
301
 
302
+ /**
303
+ * Typed Crypto Onramp API error discriminants.
304
+ */
305
+ export type OnrampApiErrorType =
306
+ | 'AppAttestationError'
307
+ | 'UncategorizedApiError';
308
+
271
309
  /**
272
310
  * Typed Crypto Onramp error discriminants returned by newer native SDKs.
273
311
  */
274
- export type OnrampErrorType = 'AppAttestationError' | 'UncategorizedApiError';
312
+ export type OnrampErrorType =
313
+ | OnrampApiErrorType
314
+ | 'AppAttestationUnavailableError';
275
315
 
276
- export type OnrampApiError = StripeError<OnrampError> & {
277
- onrampErrorType: string;
316
+ /**
317
+ * Base rich error shape returned by native Crypto Onramp SDK errors.
318
+ */
319
+ export type OnrampSdkError = StripeError<OnrampErrorStatus> & {
320
+ onrampErrorType: OnrampErrorType;
278
321
  developerMessage: string;
279
322
  userMessage: string;
323
+ docUrl?: string;
324
+ };
325
+
326
+ /**
327
+ * API-context fields returned for Crypto Onramp API errors.
328
+ */
329
+ export type OnrampApiError = OnrampSdkError & {
330
+ onrampErrorType: OnrampApiErrorType;
280
331
  reason?: string;
281
332
  requestId?: string;
282
333
  apiErrorCode?: string;
283
334
  apiErrorType?: string;
284
335
  apiErrorMessage?: string;
285
336
  apiUserMessage?: string;
286
- docUrl?: string;
287
337
  };
338
+
288
339
  /**
289
340
  * A typed Crypto Onramp app attestation failure.
290
341
  */
@@ -299,6 +350,13 @@ export type UncategorizedApiError = OnrampApiError & {
299
350
  onrampErrorType: 'UncategorizedApiError';
300
351
  };
301
352
 
353
+ /**
354
+ * A typed Crypto Onramp local SDK error for app attestation setup failures.
355
+ */
356
+ export type AppAttestationUnavailableError = OnrampSdkError & {
357
+ onrampErrorType: 'AppAttestationUnavailableError';
358
+ };
359
+
302
360
  /**
303
361
  * Error returned by Crypto Onramp APIs.
304
362
  *
@@ -307,11 +365,14 @@ export type UncategorizedApiError = OnrampApiError & {
307
365
  * `onrampErrorType`.
308
366
  */
309
367
  export type CryptoOnrampError =
310
- | (StripeError<OnrampError> & {
311
- onrampErrorType?: undefined;
368
+ | (StripeError<OnrampErrorStatus> & {
369
+ onrampErrorType?: never;
370
+ developerMessage?: never;
371
+ userMessage?: never;
312
372
  })
313
373
  | AppAttestationError
314
- | UncategorizedApiError;
374
+ | UncategorizedApiError
375
+ | AppAttestationUnavailableError;
315
376
 
316
377
  /**
317
378
  * Result of retrieving missing compliance identifiers.
@@ -456,6 +517,36 @@ export type RegisterLinkUserResult =
456
517
  error: CryptoOnrampError;
457
518
  };
458
519
 
520
+ /**
521
+ * Result of creating a wallet ownership challenge.
522
+ */
523
+ export type GetWalletOwnershipChallengeResult =
524
+ | {
525
+ /** The short-lived challenge whose message must be signed by the wallet. */
526
+ challenge: WalletOwnershipChallenge;
527
+ error?: undefined;
528
+ }
529
+ | {
530
+ challenge?: undefined;
531
+ /** Present if challenge creation failed with an error. */
532
+ error: CryptoOnrampError;
533
+ };
534
+
535
+ /**
536
+ * Result of submitting a wallet ownership signature.
537
+ */
538
+ export type SubmitWalletOwnershipSignatureResult =
539
+ | {
540
+ /** The registered wallet after ownership verification. */
541
+ consumerWallet: CryptoConsumerWallet;
542
+ error?: undefined;
543
+ }
544
+ | {
545
+ consumerWallet?: undefined;
546
+ /** Present if signature verification failed with an error. */
547
+ error: CryptoOnrampError;
548
+ };
549
+
459
550
  /**
460
551
  * Describes the payment method currently selected by the user.
461
552
  */
@@ -51,7 +51,8 @@ export type ConfirmParams =
51
51
  | PayPalParams
52
52
  | AffirmParams
53
53
  | CashAppParams
54
- | RevolutPayParams;
54
+ | RevolutPayParams
55
+ | PayByBankParams;
55
56
 
56
57
  export type ConfirmOptions = PaymentMethod.ConfirmOptions;
57
58
 
@@ -316,6 +317,15 @@ export type RevolutPayParams = {
316
317
  };
317
318
  };
318
319
 
320
+ export type PayByBankParams = {
321
+ paymentMethodType: 'PayByBank';
322
+ paymentMethodData?: {
323
+ billingDetails?: BillingDetails;
324
+ mandateData?: MandateData;
325
+ metadata?: MetaData;
326
+ };
327
+ };
328
+
319
329
  export type CollectBankAccountParams = {
320
330
  paymentMethodType: 'USBankAccount';
321
331
  paymentMethodData: {
@@ -283,6 +283,7 @@ export type Type =
283
283
  | 'Oxxo'
284
284
  | 'USBankAccount'
285
285
  | 'PayPal'
286
+ | 'PayByBank'
286
287
  | 'Unknown';
287
288
 
288
289
  export type CollectBankAccountParams = {
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.getCurrentPublishableKey=getCurrentPublishableKey;exports.setCurrentPublishableKey=setCurrentPublishableKey;var currentPublishableKey;function setCurrentPublishableKey(publishableKey){currentPublishableKey=publishableKey;}function getCurrentPublishableKey(){return currentPublishableKey;}
2
- //# sourceMappingURL=stripeConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["currentPublishableKey","setCurrentPublishableKey","publishableKey","getCurrentPublishableKey"],"sourceRoot":"../../../src","sources":["internal/stripeConfig.ts"],"mappings":"6KAAA,GAAI,CAAAA,qBAAyC,CAEtC,QAAS,CAAAC,wBAAwBA,CAACC,cAAsB,CAAQ,CACrEF,qBAAqB,CAAGE,cAAc,CACxC,CAEO,QAAS,CAAAC,wBAAwBA,CAAA,CAAuB,CAC7D,MAAO,CAAAH,qBAAqB,CAC9B","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.getCurrentPublishableKey=getCurrentPublishableKey;exports.setCurrentPublishableKey=setCurrentPublishableKey;var currentPublishableKey;function setCurrentPublishableKey(publishableKey){currentPublishableKey=publishableKey;}function getCurrentPublishableKey(){return currentPublishableKey;}
2
- //# sourceMappingURL=stripeConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["currentPublishableKey","setCurrentPublishableKey","publishableKey","getCurrentPublishableKey"],"sourceRoot":"../../../src","sources":["internal/stripeConfig.ts"],"mappings":"6KAAA,GAAI,CAAAA,qBAAyC,CAEtC,QAAS,CAAAC,wBAAwBA,CAACC,cAAsB,CAAQ,CACrEF,qBAAqB,CAAGE,cAAc,CACxC,CAEO,QAAS,CAAAC,wBAAwBA,CAAA,CAAuB,CAC7D,MAAO,CAAAH,qBAAqB,CAC9B","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export declare function setCurrentPublishableKey(publishableKey: string): void;
2
- export declare function getCurrentPublishableKey(): string | undefined;
3
- //# sourceMappingURL=stripeConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripeConfig.d.ts","sourceRoot":"","sources":["../../../../src/internal/stripeConfig.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,SAAS,CAE7D"}
@@ -1,9 +0,0 @@
1
- let currentPublishableKey: string | undefined;
2
-
3
- export function setCurrentPublishableKey(publishableKey: string): void {
4
- currentPublishableKey = publishableKey;
5
- }
6
-
7
- export function getCurrentPublishableKey(): string | undefined {
8
- return currentPublishableKey;
9
- }