@stripe/stripe-react-native 0.8.0 → 0.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +1 -0
  4. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +3 -0
  5. package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +1 -0
  6. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +1 -0
  7. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +1 -1
  8. package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +1 -1
  9. package/android/src/main/java/com/reactnativestripesdk/Mappers.kt +22 -22
  10. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +36 -5
  11. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +38 -15
  12. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +3 -8
  13. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +6 -10
  14. package/ios/CardFieldView.swift +1 -0
  15. package/ios/CardFormView.swift +1 -0
  16. package/ios/Mappers.swift +2 -0
  17. package/ios/PaymentMethodFactory.swift +8 -0
  18. package/ios/StripeSdk.swift +5 -1
  19. package/ios/pushprovisioning/AddToWalletButtonManager.m +1 -4
  20. package/ios/pushprovisioning/AddToWalletButtonView.swift +12 -14
  21. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  22. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  23. package/lib/commonjs/components/CardField.js +1 -1
  24. package/lib/commonjs/components/CardField.js.map +1 -1
  25. package/lib/commonjs/components/CardForm.js +1 -1
  26. package/lib/commonjs/components/CardForm.js.map +1 -1
  27. package/lib/commonjs/components/StripeProvider.js +1 -1
  28. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  29. package/lib/commonjs/types/SetupIntent.js.map +1 -1
  30. package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
  31. package/lib/module/components/AddToWalletButton.js +1 -1
  32. package/lib/module/components/AddToWalletButton.js.map +1 -1
  33. package/lib/module/components/CardField.js +1 -1
  34. package/lib/module/components/CardField.js.map +1 -1
  35. package/lib/module/components/CardForm.js +1 -1
  36. package/lib/module/components/CardForm.js.map +1 -1
  37. package/lib/module/components/StripeProvider.js +1 -1
  38. package/lib/module/components/StripeProvider.js.map +1 -1
  39. package/lib/module/types/SetupIntent.js.map +1 -1
  40. package/lib/module/types/components/CardFieldInput.js.map +1 -1
  41. package/lib/typescript/example/src/App.d.ts +1 -0
  42. package/lib/typescript/example/src/screens/PayPalScreen.d.ts +1 -0
  43. package/lib/typescript/src/components/AddToWalletButton.d.ts +18 -11
  44. package/lib/typescript/src/types/PaymentMethod.d.ts +8 -2
  45. package/lib/typescript/src/types/SetupIntent.d.ts +1 -1
  46. package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
  47. package/lib/typescript/src/types/components/CardFormView.d.ts +1 -0
  48. package/package.json +2 -2
  49. package/src/components/AddToWalletButton.tsx +18 -11
  50. package/src/components/CardField.tsx +2 -1
  51. package/src/components/CardForm.tsx +2 -1
  52. package/src/types/PaymentMethod.ts +10 -1
  53. package/src/types/SetupIntent.ts +18 -1
  54. package/src/types/components/CardFieldInput.ts +1 -0
  55. package/src/types/components/CardFormView.ts +1 -0
  56. package/stripe-react-native.podspec +3 -2
@@ -18,7 +18,7 @@ export interface Result {
18
18
  Upi: UpiResult;
19
19
  USBankAccount: USBankAccountResult;
20
20
  }
21
- export declare type CreateParams = CardParams | IdealParams | OxxoParams | P24Params | AlipayParams | GiropayParams | SepaParams | EpsParams | AuBecsDebitParams | SofortParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | USBankAccountParams;
21
+ export declare type CreateParams = CardParams | IdealParams | OxxoParams | P24Params | AlipayParams | GiropayParams | SepaParams | EpsParams | AuBecsDebitParams | SofortParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | USBankAccountParams | PayPalParams;
22
22
  export declare type ConfirmParams = CreateParams;
23
23
  export declare type CreateOptions = {
24
24
  setupFutureUsage?: FutureUsage;
@@ -149,6 +149,12 @@ export declare type USBankAccountParams = {
149
149
  accountType?: BankAcccountType;
150
150
  };
151
151
  };
152
+ export declare type PayPalParams = {
153
+ paymentMethodType: 'PayPal';
154
+ paymentMethodData?: {
155
+ billingDetails?: BillingDetails;
156
+ };
157
+ };
152
158
  export interface AuBecsDebitResult {
153
159
  fingerprint?: string;
154
160
  last4?: string;
@@ -198,7 +204,7 @@ export declare type USBankAccountResult = {
198
204
  preferredNetwork?: string;
199
205
  supportedNetworks?: string[];
200
206
  };
201
- export declare type Type = 'AfterpayClearpay' | 'Card' | 'Alipay' | 'GrabPay' | 'Ideal' | 'Fpx' | 'CardPresent' | 'SepaDebit' | 'AuBecsDebit' | 'BacsDebit' | 'Giropay' | 'P24' | 'Eps' | 'Bancontact' | 'Oxxo' | 'Sofort' | 'Upi' | 'USBankAccount' | 'Unknown';
207
+ export declare type Type = 'AfterpayClearpay' | 'Card' | 'Alipay' | 'GrabPay' | 'Ideal' | 'Fpx' | 'CardPresent' | 'SepaDebit' | 'AuBecsDebit' | 'BacsDebit' | 'Giropay' | 'P24' | 'Eps' | 'Bancontact' | 'Oxxo' | 'Sofort' | 'Upi' | 'USBankAccount' | 'PayPal' | 'Unknown';
202
208
  export declare type CollectBankAccountParams = {
203
209
  paymentMethodType: 'USBankAccount';
204
210
  paymentMethodData: {
@@ -15,7 +15,7 @@ export interface Result {
15
15
  description: string | null;
16
16
  nextAction: NextAction | null;
17
17
  }
18
- export declare type ConfirmParams = PaymentMethod.CreateParams;
18
+ export declare type ConfirmParams = PaymentMethod.CardParams | PaymentMethod.IdealParams | PaymentMethod.OxxoParams | PaymentMethod.P24Params | PaymentMethod.AlipayParams | PaymentMethod.GiropayParams | PaymentMethod.SepaParams | PaymentMethod.EpsParams | PaymentMethod.AuBecsDebitParams | PaymentMethod.SofortParams | PaymentMethod.GrabPayParams | PaymentMethod.FPXParams | PaymentMethod.AfterpayClearpayParams | PaymentMethod.KlarnaParams | PaymentMethod.BancontactParams | PaymentMethod.USBankAccountParams;
19
19
  export declare type ConfirmOptions = {};
20
20
  export declare type FutureUsage = 'Unknown' | 'None' | 'OnSession' | 'OffSession' | 'OneTime';
21
21
  export declare enum Status {
@@ -25,6 +25,7 @@ export interface Details {
25
25
  * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance
26
26
  */
27
27
  number?: string;
28
+ cvc?: string;
28
29
  }
29
30
  export interface Styles {
30
31
  borderWidth?: number;
@@ -17,6 +17,7 @@ export interface Details {
17
17
  * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance
18
18
  */
19
19
  number?: string;
20
+ cvc?: string;
20
21
  }
21
22
  export interface Styles {
22
23
  backgroundColor?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-react-native",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "author": "Stripe",
5
5
  "description": "Stripe SDK for React Native",
6
6
  "main": "lib/commonjs/index",
@@ -154,6 +154,6 @@
154
154
  ]
155
155
  },
156
156
  "dependencies": {
157
- "@expo/config-plugins": "^3.0.5"
157
+ "@expo/config-plugins": "^4.1.4"
158
158
  }
159
159
  }
@@ -29,14 +29,19 @@ export interface Props extends AccessibilityProps {
29
29
  testID?: string;
30
30
  /** Only set to `false` when shipping through TestFlight || App Store */
31
31
  testEnv?: boolean;
32
- /** Sets the card holder name (used only on iOS) */
33
- cardHolderName: string;
34
- /** Last 4 digits of the card. Required on Android. */
35
- cardLastFour: string;
36
- /** Sets the card holder name (used only on iOS) */
37
- cardDescription?: string;
38
- /** Optional, only used on iOS */
39
- cardBrand?: Token.CardBrand;
32
+ /** Details of the Issued Card you'd like added to the device's wallet */
33
+ cardDetails: {
34
+ /** The `primary_account_identifier` value from the issued card. */
35
+ primaryAccountIdentifier: string | null;
36
+ /** The card holder name (used only on iOS) */
37
+ name: string;
38
+ /** A user-facing description of the card. Required on Android.*/
39
+ description: string;
40
+ /** Last 4 digits of the card, only used on iOS */
41
+ lastFour?: string;
42
+ /** Optional, only used on iOS */
43
+ brand?: Token.CardBrand;
44
+ };
40
45
  // Optional, only for Android and only for cards that are in the "yellow path" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.
41
46
  token?: GooglePayCardToken | null;
42
47
  /** Used by stripe to securely obtain card info of the card being provisioned. */
@@ -54,9 +59,11 @@ export interface Props extends AccessibilityProps {
54
59
  * testEnv={true}
55
60
  * style={styles.myButtonStyle}
56
61
  * iOSButtonStyle="onLightBackground"
57
- * cardHolderName="David Wallace"
58
- * cardLastFour="4242"
59
- * cardBrand="Visa"
62
+ * cardDetails={{
63
+ * primaryAccountIdentifier: "V-123",
64
+ * name: "David Wallace",
65
+ * lastFour: "4242",
66
+ * }}
60
67
  * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend
61
68
  * onComplete={(error) => {
62
69
  * Alert.alert(
@@ -98,8 +98,9 @@ export const CardField = forwardRef<CardFieldInput.Methods, Props>(
98
98
  if (card.hasOwnProperty('postalCode')) {
99
99
  data.postalCode = card.postalCode || '';
100
100
  }
101
- if (card.hasOwnProperty('number')) {
101
+ if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {
102
102
  data.number = card.number || '';
103
+ data.cvc = card.cvc || '';
103
104
  if (__DEV__ && onCardChange && card.complete) {
104
105
  console.warn(
105
106
  `[stripe-react-native] ⚠️ WARNING: You've enabled \`dangerouslyGetFullCardDetails\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`
@@ -101,8 +101,9 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
101
101
  postalCode: card.postalCode,
102
102
  };
103
103
 
104
- if (card.hasOwnProperty('number')) {
104
+ if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {
105
105
  data.number = card.number || '';
106
+ data.cvc = card.cvc || '';
106
107
  if (__DEV__ && onFormComplete && card.complete) {
107
108
  console.warn(
108
109
  `[stripe-react-native] ⚠️ WARNING: You've enabled \`dangerouslyGetFullCardDetails\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`
@@ -41,7 +41,8 @@ export type CreateParams =
41
41
  | KlarnaParams
42
42
  // | WeChatPayParams
43
43
  | BancontactParams
44
- | USBankAccountParams;
44
+ | USBankAccountParams
45
+ | PayPalParams;
45
46
 
46
47
  export type ConfirmParams = CreateParams;
47
48
 
@@ -191,6 +192,13 @@ export type USBankAccountParams = {
191
192
  };
192
193
  };
193
194
 
195
+ export type PayPalParams = {
196
+ paymentMethodType: 'PayPal';
197
+ paymentMethodData?: {
198
+ billingDetails?: BillingDetails;
199
+ };
200
+ };
201
+
194
202
  export interface AuBecsDebitResult {
195
203
  fingerprint?: string;
196
204
  last4?: string;
@@ -268,6 +276,7 @@ export type Type =
268
276
  | 'Sofort'
269
277
  | 'Upi'
270
278
  | 'USBankAccount'
279
+ | 'PayPal'
271
280
  | 'Unknown';
272
281
 
273
282
  export type CollectBankAccountParams = {
@@ -16,7 +16,24 @@ export interface Result {
16
16
  nextAction: NextAction | null;
17
17
  }
18
18
 
19
- export type ConfirmParams = PaymentMethod.CreateParams;
19
+ export type ConfirmParams =
20
+ | PaymentMethod.CardParams
21
+ | PaymentMethod.IdealParams
22
+ | PaymentMethod.OxxoParams
23
+ | PaymentMethod.P24Params
24
+ | PaymentMethod.AlipayParams
25
+ | PaymentMethod.GiropayParams
26
+ | PaymentMethod.SepaParams
27
+ | PaymentMethod.EpsParams
28
+ | PaymentMethod.AuBecsDebitParams
29
+ | PaymentMethod.SofortParams
30
+ | PaymentMethod.GrabPayParams
31
+ | PaymentMethod.FPXParams
32
+ | PaymentMethod.AfterpayClearpayParams
33
+ | PaymentMethod.KlarnaParams
34
+ | PaymentMethod.BancontactParams
35
+ | PaymentMethod.USBankAccountParams;
36
+ // TODO: Change the above back to PaymentMethod.CreateParams when PayPal is supported through SetupIntents
20
37
 
21
38
  export type ConfirmOptions = {};
22
39
 
@@ -28,6 +28,7 @@ export interface Details {
28
28
  * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance
29
29
  */
30
30
  number?: string;
31
+ cvc?: string;
31
32
  }
32
33
 
33
34
  export interface Styles {
@@ -19,6 +19,7 @@ export interface Details {
19
19
  * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance
20
20
  */
21
21
  number?: string;
22
+ cvc?: string;
22
23
  }
23
24
 
24
25
  export interface Styles {
@@ -1,6 +1,7 @@
1
1
  require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+ stripe_version = '~> 22.3.0'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = 'stripe-react-native'
@@ -16,6 +17,6 @@ Pod::Spec.new do |s|
16
17
  s.source_files = 'ios/**/*.{h,m,mm,swift}'
17
18
 
18
19
  s.dependency 'React-Core'
19
- s.dependency 'Stripe', '~> 22.0.0'
20
- s.dependency 'StripeConnections', '~> 22.0.0'
20
+ s.dependency 'Stripe', stripe_version
21
+ s.dependency 'StripeFinancialConnections', stripe_version
21
22
  end