@stripe/stripe-react-native 0.28.0 → 0.30.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/CHANGELOG.md +95 -68
- package/README.md +2 -2
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +0 -5
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +11 -27
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +35 -8
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +131 -6
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +42 -7
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +8 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +14 -1
- package/ios/ApplePayButtonView.swift +4 -18
- package/ios/ApplePayViewController.swift +1 -28
- package/ios/Mappers.swift +1 -0
- package/ios/StripeSdk+PaymentSheet.swift +100 -10
- package/ios/StripeSdk.m +22 -29
- package/ios/StripeSdk.swift +59 -85
- package/jest/mock.js +4 -6
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/ApplePay.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/components/GooglePayButtonComponent.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/ApplePayButtonNative.js.map +1 -1
- package/lib/module/components/GooglePayButtonNative.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/ApplePay.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/components/GooglePayButtonComponent.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +5 -15
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +1 -1
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +1 -1
- package/lib/typescript/src/functions.d.ts +15 -27
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +3 -18
- package/lib/typescript/src/index.d.ts +0 -7
- package/lib/typescript/src/types/ApplePay.d.ts +0 -52
- package/lib/typescript/src/types/PaymentIntent.d.ts +3 -2
- package/lib/typescript/src/types/PaymentSheet.d.ts +48 -2
- package/lib/typescript/src/types/PlatformPay.d.ts +34 -4
- package/lib/typescript/src/types/PushProvisioning.d.ts +9 -1
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +0 -1
- package/lib/typescript/src/types/index.d.ts +8 -4
- package/package.json +1 -1
- package/src/NativeStripeSdk.tsx +11 -31
- package/src/components/ApplePayButtonNative.tsx +1 -1
- package/src/components/GooglePayButtonNative.tsx +1 -1
- package/src/functions.ts +87 -197
- package/src/hooks/useFinancialConnectionsSheet.tsx +19 -13
- package/src/hooks/usePaymentSheet.tsx +25 -18
- package/src/hooks/useStripe.tsx +14 -108
- package/src/index.tsx +0 -7
- package/src/types/ApplePay.ts +0 -71
- package/src/types/PaymentIntent.ts +4 -2
- package/src/types/PaymentSheet.ts +86 -2
- package/src/types/PlatformPay.ts +35 -4
- package/src/types/PushProvisioning.ts +9 -1
- package/src/types/components/GooglePayButtonComponent.ts +0 -1
- package/src/types/index.ts +10 -6
- package/stripe-react-native.podspec +1 -1
- package/lib/commonjs/components/ApplePayButton.js +0 -2
- package/lib/commonjs/components/ApplePayButton.js.map +0 -1
- package/lib/commonjs/components/GooglePayButton.js +0 -2
- package/lib/commonjs/components/GooglePayButton.js.map +0 -1
- package/lib/commonjs/hooks/useApplePay.js +0 -2
- package/lib/commonjs/hooks/useApplePay.js.map +0 -1
- package/lib/commonjs/hooks/useGooglePay.js +0 -2
- package/lib/commonjs/hooks/useGooglePay.js.map +0 -1
- package/lib/commonjs/types/GooglePay.js +0 -2
- package/lib/commonjs/types/GooglePay.js.map +0 -1
- package/lib/module/components/ApplePayButton.js +0 -2
- package/lib/module/components/ApplePayButton.js.map +0 -1
- package/lib/module/components/GooglePayButton.js +0 -2
- package/lib/module/components/GooglePayButton.js.map +0 -1
- package/lib/module/hooks/useApplePay.js +0 -2
- package/lib/module/hooks/useApplePay.js.map +0 -1
- package/lib/module/hooks/useGooglePay.js +0 -2
- package/lib/module/hooks/useGooglePay.js.map +0 -1
- package/lib/module/types/GooglePay.js +0 -2
- package/lib/module/types/GooglePay.js.map +0 -1
- package/lib/typescript/src/components/ApplePayButton.d.ts +0 -31
- package/lib/typescript/src/components/GooglePayButton.d.ts +0 -26
- package/lib/typescript/src/hooks/useApplePay.d.ts +0 -54
- package/lib/typescript/src/hooks/useGooglePay.d.ts +0 -11
- package/lib/typescript/src/types/GooglePay.d.ts +0 -47
- package/src/components/ApplePayButton.tsx +0 -108
- package/src/components/GooglePayButton.tsx +0 -58
- package/src/hooks/useApplePay.tsx +0 -161
- package/src/hooks/useGooglePay.tsx +0 -72
- package/src/types/GooglePay.ts +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.30.0 - 2023-08-04
|
|
6
|
+
|
|
7
|
+
**Features**
|
|
8
|
+
|
|
9
|
+
- Added the `handleNextActionForSetup` method. This can be used exactly like `handleNextAction`, except with [SetupIntents](https://stripe.com/docs/api/setup_intents). [#1440](https://github.com/stripe/stripe-react-native/pull/1440)
|
|
10
|
+
- `canAddCardToWallet` now returns the `fpanLastFour` and `dpanLastFour` in the `GooglePayCardToken` type. The `cardLastFour` field (which is now superseded by `fpanLastFour`) is deprecated.
|
|
11
|
+
|
|
12
|
+
**Fixes**
|
|
13
|
+
|
|
14
|
+
- Fixed an error on Android where `AddressSheet` would throw an error if submitted with the keyboard open. [#1462](https://github.com/stripe/stripe-react-native/pull/1462)
|
|
15
|
+
- Fixed an issue where `state` was not included in the returned PaymentIntent's `shippingDetails` on iOS. [#1465](https://github.com/stripe/stripe-react-native/pull/1465)
|
|
16
|
+
- Fixed an error where `usePaymentSheet` could cause infinite reloads. [#1439](https://github.com/stripe/stripe-react-native/pull/1439)'
|
|
17
|
+
|
|
18
|
+
## 0.29.0 - 2023-07-13
|
|
19
|
+
|
|
20
|
+
**Breaking changes**
|
|
21
|
+
|
|
22
|
+
- The Apple Pay and Google Pay APIs, which are deprecated and were replaced with the [Platform Pay API](https://github.com/stripe/stripe-react-native/blob/master/docs/Platform-Pay-Migration.md) last year, have been removed. [#1424](https://github.com/stripe/stripe-react-native/pull/1424)
|
|
23
|
+
|
|
24
|
+
**Features**
|
|
25
|
+
|
|
26
|
+
- You can now collect payment details before creating a `PaymentIntent` or `SetupIntent`. See [our docs](https://stripe.com/docs/payments/accept-a-payment-deferred?platform=react-native) for more info. This integration also allows you to [confirm the Intent on the server](https://stripe.com/docs/payments/finalize-payments-on-the-server?platform=react-native). [#1424](https://github.com/stripe/stripe-react-native/pull/1424)
|
|
27
|
+
|
|
28
|
+
**Fixes**
|
|
29
|
+
|
|
30
|
+
- Fixes `handleURLCallback` to only take action on iOS, no-op on Android. [#1423](https://github.com/stripe/stripe-react-native/pull/1423)
|
|
31
|
+
|
|
5
32
|
## 0.28.0 - 2023-06-16
|
|
6
33
|
|
|
7
|
-
|
|
34
|
+
**Features**
|
|
8
35
|
|
|
9
|
-
- Added a `disabled` prop to `CardField` and `CardForm` which applies a disabled state such that user input is not accepted.
|
|
36
|
+
- Added a `disabled` prop to `CardField` and `CardForm` which applies a disabled state such that user input is not accepted. [#1403](https://github.com/stripe/stripe-react-native/pull/1403)
|
|
10
37
|
|
|
11
|
-
|
|
38
|
+
**Fixes**
|
|
12
39
|
|
|
13
40
|
- Fixed an instance on Android where `collectBankAccountToken` or `collectFinancialConnectionsAccounts` could result in a fatal error. [#1401](https://github.com/stripe/stripe-react-native/pull/1401)
|
|
14
|
-
- Resolve with better error objects on iOS in `confirmPaymentSheetPayment`, `createTokenForCVCUpdate`, `createPaymentMethod`, `retrievePaymentIntent`, and `retrieveSetupIntent`
|
|
41
|
+
- Resolve with better error objects on iOS in `confirmPaymentSheetPayment`, `createTokenForCVCUpdate`, `createPaymentMethod`, `retrievePaymentIntent`, and `retrieveSetupIntent` [#1399](https://github.com/stripe/stripe-react-native/pull/1399)
|
|
15
42
|
|
|
16
43
|
## 0.27.2 - 2023-05-15
|
|
17
44
|
|
|
18
|
-
|
|
45
|
+
**Fixes**
|
|
19
46
|
|
|
20
47
|
- Updated `stripe-android` from 20.24.0 to 20.25.+ [#1384](https://github.com/stripe/stripe-react-native/pull/1384)
|
|
21
48
|
- Updated `stripe-ios` from 23.7.+ to 23.8.+ [#1384](https://github.com/stripe/stripe-react-native/pull/1384)
|
|
@@ -24,7 +51,7 @@
|
|
|
24
51
|
|
|
25
52
|
> Note: [Xcode 13 is no longer supported by Apple](https://developer.apple.com/news/upcoming-requirements/). Please upgrade to Xcode 14.1 or later.
|
|
26
53
|
|
|
27
|
-
|
|
54
|
+
**Fixes**
|
|
28
55
|
|
|
29
56
|
- Fixed the type of `created` on `Token.Result` on Android (was a number, should be a string). [#1369](https://github.com/stripe/stripe-react-native/pull/1369)
|
|
30
57
|
- Fixed `AddToWalletButton` not properly resolving the `androidAssetSource` in release mode. [#1373](https://github.com/stripe/stripe-react-native/pull/1373)
|
|
@@ -32,11 +59,11 @@
|
|
|
32
59
|
|
|
33
60
|
## 0.27.0 - 2023-04-21
|
|
34
61
|
|
|
35
|
-
|
|
62
|
+
**Features**
|
|
36
63
|
|
|
37
64
|
- Added `billingDetailsCollectionConfiguration` to `initPaymentSheet` parameters. Use this to configure the collection of email, phone, name, or address in the Payment Sheet. [See the docs here](https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#collect-billing-details) [#1361](https://github.com/stripe/stripe-react-native/pull/1361)
|
|
38
65
|
|
|
39
|
-
|
|
66
|
+
**Fixes**
|
|
40
67
|
|
|
41
68
|
- Updated Google Pay button asset to match Google's most recent branding guidelines. [#1343](https://github.com/stripe/stripe-react-native/pull/1343)
|
|
42
69
|
- Fixed type for `ApplePay.ShippingContact.phoneNumber`. [#1349](https://github.com/stripe/stripe-react-native/pull/1349)
|
|
@@ -44,21 +71,21 @@
|
|
|
44
71
|
|
|
45
72
|
## 0.26.0 - 2023-03-16
|
|
46
73
|
|
|
47
|
-
|
|
74
|
+
**Features**
|
|
48
75
|
|
|
49
76
|
- Added support for PayPal and CashApp to PaymentSheet, `confirmPayment`, and `confirmSetupIntent`. [#1331](https://github.com/stripe/stripe-react-native/pull/1331)
|
|
50
77
|
|
|
51
|
-
|
|
78
|
+
**Fixes**
|
|
52
79
|
|
|
53
80
|
- Compatible with v0.1.4 of `@stripe/stripe-identity-react-native`. [8fa8a7a](https://github.com/stripe/stripe-react-native/commit/8fa8a7a0595a31d7422af6bbe26d696ba5e211f7)
|
|
54
81
|
|
|
55
82
|
## 0.25.0 - 2023-02-27
|
|
56
83
|
|
|
57
|
-
|
|
84
|
+
**Features**
|
|
58
85
|
|
|
59
86
|
- Added the `supportsTapToPay` option to `canAddCardToWallet`. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)
|
|
60
87
|
|
|
61
|
-
|
|
88
|
+
**Fixes**
|
|
62
89
|
|
|
63
90
|
- Fixed an issue on iOS where `canAddCardToWallet` would always return a `details.status` of `UNSUPPORTED_DEVICE` on iPads. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
|
|
64
91
|
- Fixed an issue on iOS where `canAddCardToWallet` would always return a `{canAddCard: false}` if the card in question had been provsioned on the current device, but **had not yet been provisioned** on a paired Watch. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
|
|
@@ -67,9 +94,9 @@
|
|
|
67
94
|
|
|
68
95
|
## 0.24.0 - 2023-02-17
|
|
69
96
|
|
|
70
|
-
|
|
97
|
+
**Breaking changes**
|
|
71
98
|
|
|
72
|
-
-
|
|
99
|
+
- [#1248](https://github.com/stripe/stripe-react-native/pull/1248) Renamed the `paymentSummaryItems` field in `initPaymentSheet()`'s `applePay` params to `cartItems`. So your change will look like this:
|
|
73
100
|
|
|
74
101
|
```diff
|
|
75
102
|
initPaymentSheet({
|
|
@@ -82,22 +109,22 @@
|
|
|
82
109
|
})
|
|
83
110
|
```
|
|
84
111
|
|
|
85
|
-
|
|
112
|
+
**Features**
|
|
86
113
|
|
|
87
114
|
- Added the `setOrderTracking` property to the `PlatformPayButton` component and the `initPaymentSheet` method. Use this callback for setting the order details to give users the ability to track and manage their purchases in Wallet. To learn more about order tracking, see [Apple’s Wallet Orders documentation](https://developer.apple.com/documentation/walletorders). [#1248](https://github.com/stripe/stripe-react-native/pull/1248)
|
|
88
115
|
- Added the `buttonType` field to `initPaymentSheet()`'s `applePay` params. Use this to set the text displayed by the call to action button in the Apple Pay sheet.[#1248](https://github.com/stripe/stripe-react-native/pull/1248)
|
|
89
|
-
- Added the `request` field to `initPaymentSheet()`'s, `confirmPlatformPayPayment()`'s, and `confirmPlatformPaySetupIntent`'s
|
|
116
|
+
- Added the `request` field to `initPaymentSheet()`'s, `confirmPlatformPayPayment()`'s, and `confirmPlatformPaySetupIntent`'s `applePay` params. Use this to support different types of payment requests, like `RecurringPaymentRequest`, `AutomaticReloadPaymentRequest`, and `MultiMerchantRequest`.[#1248](https://github.com/stripe/stripe-react-native/pull/1248)
|
|
90
117
|
- Added an `options` argument to `presentPaymentSheet` which includes a `timeout` property. [#1287](https://github.com/stripe/stripe-react-native/pull/1287)
|
|
91
118
|
|
|
92
119
|
## 0.23.3 - 2023-02-07 (📌 Expo SDK 48)
|
|
93
120
|
|
|
94
|
-
|
|
121
|
+
**Fixes**
|
|
95
122
|
|
|
96
123
|
- Fixes a build failure on Android when using `stripe-android` v20.19.2. [#1289](https://github.com/stripe/stripe-react-native/pull/1289)
|
|
97
124
|
|
|
98
125
|
## 0.23.2 - 2023-02-06
|
|
99
126
|
|
|
100
|
-
|
|
127
|
+
**Fixes**
|
|
101
128
|
|
|
102
129
|
- Fixed a bug on Android where `canAddCardToWallet` wouldn't correctly return the `details.token` object. [#1282](https://github.com/stripe/stripe-react-native/pull/1282)
|
|
103
130
|
|
|
@@ -105,7 +132,7 @@
|
|
|
105
132
|
|
|
106
133
|
> **Note**: This version pulls in a new version of `stripe-android` that now requires v1.8.0 of the Kotlin Gradle plugin. [Refer to this issue for a limited workaround](https://github.com/stripe/stripe-react-native/issues/1294#issuecomment-1426150258).
|
|
107
134
|
|
|
108
|
-
|
|
135
|
+
**Fixes**
|
|
109
136
|
|
|
110
137
|
- Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
|
|
111
138
|
- Fixed types so that Klarna accepts the `shippingDetails` property. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
|
|
@@ -113,12 +140,12 @@
|
|
|
113
140
|
|
|
114
141
|
## 0.23.0 - 2023-01-09
|
|
115
142
|
|
|
116
|
-
|
|
143
|
+
**Breaking changes**
|
|
117
144
|
|
|
118
145
|
- `createPlatformPayPaymentMethod` no longer returns a `token` object. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
119
146
|
- If your integration depends on Stripe's Tokens API, please use `createPlatformPayToken`, which accepts identical arguments.
|
|
120
147
|
|
|
121
|
-
|
|
148
|
+
**Fixes**
|
|
122
149
|
|
|
123
150
|
- Fixed an issue with `createPlatformPayPaymentMethod` on iOS where a "Canceled" error could be returned in production. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
124
151
|
- Fixed an issue where the `PlatformPayButton` with `type={PlatformPay.ButtonType.GooglePayMark}` would be unclickable. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
@@ -127,7 +154,7 @@
|
|
|
127
154
|
|
|
128
155
|
## 0.22.1 - 2022-12-07
|
|
129
156
|
|
|
130
|
-
|
|
157
|
+
**Fixes**
|
|
131
158
|
|
|
132
159
|
- Fixed the `ShippingMethod` type to contain the `isPending` field instead of a `type` field (which previously was never correct). This reflects the inputs accepted. [#1227](https://github.com/stripe/stripe-react-native/pull/1227)
|
|
133
160
|
- Fixed the `ShippingMethod` type to contain the `startDate` and `endDate` keys, if applicable. [#1227](https://github.com/stripe/stripe-react-native/pull/1227)
|
|
@@ -136,14 +163,14 @@
|
|
|
136
163
|
|
|
137
164
|
## 0.22.0 - 2022-12-02
|
|
138
165
|
|
|
139
|
-
|
|
166
|
+
**Breaking changes**
|
|
140
167
|
|
|
141
|
-
|
|
168
|
+
**Features**
|
|
142
169
|
|
|
143
170
|
- Added the `hasPairedAppleWatch` option to `canAddCardToWallet`. [#1219](https://github.com/stripe/stripe-react-native/pull/1219)
|
|
144
171
|
- Added new functions and a new component to streamline integrating with Apple and Google Pay and add more feature support. See the [Migrating to Platform Pay guide](https://github.com/stripe/stripe-react-native/blob/master/docs/Platform-Pay-Migration.md) for more details. The old Apple and Google Pay APIs are marked as `deprecated` and will be removed in a future release, but are still supported in this version.
|
|
145
172
|
|
|
146
|
-
|
|
173
|
+
**Fixes**
|
|
147
174
|
|
|
148
175
|
- Fixed an issue where builds would error with the message `'const' enums are not supported.` [see commit](https://github.com/stripe/stripe-react-native/commit/f882bfa588aa6d23a980b4b43d2cca660ca1dd2a)
|
|
149
176
|
- Fixed an issue where the `canAddCardToWallet` method would sometimes wrongly return `false` with a `details.status` of `MISSING_CONFIGURATION` in production builds. [#1215](https://github.com/stripe/stripe-react-native/pull/1215)
|
|
@@ -152,25 +179,25 @@
|
|
|
152
179
|
|
|
153
180
|
## 0.21.0 - 2022-11-15
|
|
154
181
|
|
|
155
|
-
|
|
182
|
+
**Breaking changes**
|
|
156
183
|
|
|
157
|
-
|
|
184
|
+
**Features**
|
|
158
185
|
|
|
159
186
|
- Added the `<AddressSheet />` component, which enables you to collect local and international shipping or billing addresses from your customers _with_ address autocomplete. [#1169](https://github.com/stripe/stripe-react-native/pull/1169)
|
|
160
187
|
- [Find the docs here](https://stripe.com/docs/elements/address-element?platform=react-native)
|
|
161
188
|
- Added the `defaultShippingDetails` field to the `params` argument in `initPaymentSheet(params)`. This will allow you to collect shipping details (either in your own UI or using the new `<AddressSheet />` component) for payments in the Payment Sheet. [#1169](https://github.com/stripe/stripe-react-native/pull/1169)
|
|
162
189
|
|
|
163
|
-
|
|
190
|
+
**Fixes**
|
|
164
191
|
|
|
165
192
|
- Fixed a build error on Android when using Kotlin version 1.7.10. [#1195](https://github.com/stripe/stripe-react-native/pull/1195)
|
|
166
193
|
|
|
167
194
|
## 0.20.0 - 2022-11-03
|
|
168
195
|
|
|
169
|
-
|
|
196
|
+
**Breaking changes**
|
|
170
197
|
|
|
171
198
|
- This library now supports iOS 13 and up, due to `stripe-ios` increasing the deployment target. If you would like to build for iOS 12, please continue to use `@stripe/stripe-react-native@0.19.0`. [#1190](https://github.com/stripe/stripe-react-native/pull/1190)
|
|
172
199
|
|
|
173
|
-
|
|
200
|
+
**Features**
|
|
174
201
|
|
|
175
202
|
- Added [Link](https://stripe.com/docs/payments/link) support in Payment Sheet. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
|
|
176
203
|
- Added the `resetPaymentSheetCustomer` method to clear persisted authentication state in the PaymentSheet. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
|
|
@@ -178,7 +205,7 @@
|
|
|
178
205
|
- Added support for custom fonts to `CardForm` and `CardView` on Android. [#1150](https://github.com/stripe/stripe-react-native/pull/1150)
|
|
179
206
|
- Added support for customizing the call to action button label in Payment Sheet by providing the `primaryButtonLabel` property to `initPaymentSheet()`. [#1190](https://github.com/stripe/stripe-react-native/pull/1190)
|
|
180
207
|
|
|
181
|
-
|
|
208
|
+
**Fixes**
|
|
182
209
|
|
|
183
210
|
- Fixed an issue on iOS where `confirmSetupIntent` would throw an error if the `Card` payment method was provided with the `paymentMethodId` parameter. [#1151](https://github.com/stripe/stripe-react-native/pull/1151)
|
|
184
211
|
- Upgraded `stripe-android` to 20.15.+. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
|
|
@@ -189,16 +216,16 @@
|
|
|
189
216
|
|
|
190
217
|
## 0.19.0 - 2022-09-16 (📌 Expo SDK 47)
|
|
191
218
|
|
|
192
|
-
|
|
219
|
+
**Breaking changes**
|
|
193
220
|
|
|
194
221
|
- To comply with Google's [new branding guidelines for the Google Pay button](https://developers.google.com/pay/api/android/guides/brand-guidelines), the `<GooglePayButton />` component's `type` prop now only accepts `standard` or `pay` (`pay_shadow`, `pay_dark`, `standard_shadow`, and `standard_dark` were all removed). It defaults to `standard`. [#1135](https://github.com/stripe/stripe-react-native/pull/1135)
|
|
195
222
|
- Your `compileSdkVersion` (in `android/build.gradle`) now must be at least 33. Changing your `compileSdkVersion` does not change runtime behavior.
|
|
196
223
|
|
|
197
|
-
|
|
224
|
+
**Features**
|
|
198
225
|
|
|
199
226
|
- Add `returnURL` as an optional parameter to `handleNextAction`. Use this so the Stripe SDK can redirect back to your app after authentication. [#1104](https://github.com/stripe/stripe-react-native/pull/1104)
|
|
200
227
|
|
|
201
|
-
|
|
228
|
+
**Fixes**
|
|
202
229
|
|
|
203
230
|
- Fixed an issue where the error resolved on iOS wasn't the root error. [#1105](https://github.com/stripe/stripe-react-native/pull/1105)
|
|
204
231
|
- Fix Expo Config Plugin support on SDK 46. [#1111](https://github.com/stripe/stripe-react-native/pull/1111)
|
|
@@ -206,39 +233,39 @@
|
|
|
206
233
|
|
|
207
234
|
## 0.18.1 - 2022-08-19
|
|
208
235
|
|
|
209
|
-
|
|
236
|
+
**Breaking changes**
|
|
210
237
|
|
|
211
|
-
|
|
238
|
+
**Features**
|
|
212
239
|
|
|
213
|
-
|
|
240
|
+
**Fixes**
|
|
214
241
|
|
|
215
242
|
- Fixed an issue where some promises on Android would never resolve when using React Native 0.65.x or under. [#1089](https://github.com/stripe/stripe-react-native/pull/1089).
|
|
216
243
|
|
|
217
244
|
## 0.18.0 - 2022-08-17
|
|
218
245
|
|
|
219
|
-
|
|
246
|
+
**Breaking changes**
|
|
220
247
|
|
|
221
248
|
- Your `compileSdkVersion` (in `android/build.gradle`) now must be at least `32`. Changing your `compileSdkVersion` does not change runtime behavior.
|
|
222
249
|
|
|
223
|
-
|
|
250
|
+
**Features**
|
|
224
251
|
|
|
225
252
|
- `confirmPayment` can now be called with _just_ a client secret (e.g. `await confirmPayment("payment-intent-id")`), in other words the payment method can be excluded. If the payment method is excluded, it is assumed by the SDK that you have attached the payment method on the server-side during payment intent creation. [#1084](https://github.com/stripe/stripe-react-native/pull/1084)
|
|
226
253
|
- Payment Sheet now supports Link on iOS. [#1086](https://github.com/stripe/stripe-react-native/pull/1086).
|
|
227
254
|
|
|
228
|
-
|
|
255
|
+
**Fixes**
|
|
229
256
|
|
|
230
257
|
- Fixed a bug on Android where `collectBankAccountForPayment`, `collectBankAccountForSetup`, `collectBankAccountToken`, and `collectFinancialConnectionsAccounts` wouldn't work with Stripe Connect accounts. [#1086](https://github.com/stripe/stripe-react-native/pull/1086).
|
|
231
258
|
- Upgraded `stripe-ios` to 22.7.+ and `stripe-android` to 20.9.+.
|
|
232
259
|
|
|
233
260
|
## 0.17.0 - 2022-08-11
|
|
234
261
|
|
|
235
|
-
|
|
262
|
+
**Breaking changes**
|
|
236
263
|
|
|
237
|
-
|
|
264
|
+
**Features**
|
|
238
265
|
|
|
239
266
|
- Added the [`collectBankAccountToken`](https://stripe.com/docs/financial-connections/connect-payouts?platform=react-native) & [`collectFinancialConnectionsAccounts`](https://stripe.com/docs/financial-connections/other-data-powered-products?platform=react-native) functions.
|
|
240
267
|
|
|
241
|
-
|
|
268
|
+
**Fixes**
|
|
242
269
|
|
|
243
270
|
- Fixed an issue where `collectBankAccountForPayment` and `collectBankAccountForSetup` would fail on Android when using React Native 0.65.x or under. [#1059](https://github.com/stripe/stripe-react-native/pull/1059)
|
|
244
271
|
- Fixed an issue where Android apps could crash with the error `IllegalStateException: Cannot remove Fragment attached to a different FragmentManager`. [#1054](https://github.com/stripe/stripe-react-native/pull/1054)
|
|
@@ -246,25 +273,25 @@
|
|
|
246
273
|
|
|
247
274
|
## 0.16.0 - 2022-07-22
|
|
248
275
|
|
|
249
|
-
|
|
276
|
+
**Breaking changes**
|
|
250
277
|
|
|
251
278
|
- The `<GooglePayButton />` component no longer overrides the `type` to use the dark mode version when the device is in Dark Mode. If you set the `type` value, it will always be respected. If you don't set the `type` value, it will match the system's theme (`standard_shadow` when in Light Mode, and `standard_dark` when in Dark Mode). [#1051](https://github.com/stripe/stripe-react-native/pull/1051)
|
|
252
279
|
|
|
253
|
-
|
|
280
|
+
**Features**
|
|
254
281
|
|
|
255
282
|
- Added support for `pay_dark` and `standard_dark` to the `<GooglePayButton />` component's `type` prop. This allows you to display the [dark Google Pay button](https://developers.google.com/pay/api/android/guides/brand-guidelines). [#1051](https://github.com/stripe/stripe-react-native/pull/1051)
|
|
256
283
|
- Added support for `borderColor`, `borderRadius`, and `cursorColor` to `CardForm`'s `cardStyle` prop on iOS (already exists on Android). [#1048](https://github.com/stripe/stripe-react-native/pull/1048)
|
|
257
284
|
|
|
258
|
-
|
|
285
|
+
**Fixes**
|
|
259
286
|
|
|
260
287
|
- Reduced the size of the `@stripe/stripe-react-native` by preventing unnecessary files from being published. [#1043](https://github.com/stripe/stripe-react-native/pull/1043)
|
|
261
288
|
|
|
262
289
|
## 0.15.0 - 2022-07-14
|
|
263
290
|
|
|
264
|
-
|
|
291
|
+
**Breaking changes**
|
|
265
292
|
|
|
266
293
|
- [#1020](https://github.com/stripe/stripe-react-native/pull/1020) Changed some of fields for the `params` object that is supplied to `initPaymentSheet(params)`:
|
|
267
|
-
- **Changed the `applePay` field**. Previously this field accepted a boolean, now it accepts an object of type `ApplePayParams`, which includes the `merchantCountryCode` field, and a new `paymentSummaryItems` field (see "
|
|
294
|
+
- **Changed the `applePay` field**. Previously this field accepted a boolean, now it accepts an object of type `ApplePayParams`, which includes the `merchantCountryCode` field, and a new `paymentSummaryItems` field (see "Features" below).
|
|
268
295
|
- **Changed the `googlePay` field**. Previously this field accepted a boolean, now it accepts an object of type `GooglePayParams`, which includes the `merchantCountryCode`, `currencyCode`, and `testEnv` fields.
|
|
269
296
|
- Since the `merchantCountryCode` field now lives under the `applePay` and `googlePay` objects, it has been removed from the base `params` object.
|
|
270
297
|
- Similarly, since the `currencyCode` and `testEnv` fields now live under the `googlePay` object, they have been removed from the base `params` object .
|
|
@@ -273,13 +300,13 @@
|
|
|
273
300
|
- The same change was made to `ApplePay.ShippingMethod`: renamed `type` to `isPending`.
|
|
274
301
|
- Added a **new** `paymentType` field. This field is **required**, and in all pre-existing cases where you created a `CartSummaryItem`, should be set to `paymentType: 'Immediate'` (support for types `Deferred` and `Recurring` wasn't available until this release).
|
|
275
302
|
|
|
276
|
-
|
|
303
|
+
**Features**
|
|
277
304
|
|
|
278
305
|
- Added support for iOS 15 `paymentSummaryItems`: `PKDeferredPaymentSummaryItem` and `PKRecurringPaymentSummaryItem`.
|
|
279
306
|
- You can now specify Apple Pay line items to be displayed when paying with Apple Pay in PaymentSheet by providing `applePay.paymentSummaryItems` to the `initPaymentSheet` method. [#1020](https://github.com/stripe/stripe-react-native/pull/1020)
|
|
280
307
|
- Added support for Affirm (previously, Affirm was only available in the Payment Sheet). [1036](https://github.com/stripe/stripe-react-native/pull/1036)
|
|
281
308
|
|
|
282
|
-
|
|
309
|
+
**Fixes**
|
|
283
310
|
|
|
284
311
|
- Fixed behavior of `CardField` and `CardForm` on Android to match that on iOS; postal code input no longer accepts characters that are never present in postal codes (anything besides 0-9, a-z, A-Z, hyphens, and whitespace). [#1027](https://github.com/stripe/stripe-react-native/pull/1027).
|
|
285
312
|
- Fixed an issue on older version of React Native where calling `collectBankAccountForSetup` or `collectBankAccountForPayment` and getting a `Canceled` result could cause a crash. [#1037](https://github.com/stripe/stripe-react-native/pull/1037)
|
|
@@ -287,13 +314,13 @@
|
|
|
287
314
|
|
|
288
315
|
## 0.14.0 - 2022-06-30
|
|
289
316
|
|
|
290
|
-
|
|
317
|
+
**Breaking changes**
|
|
291
318
|
|
|
292
|
-
|
|
319
|
+
**Features**
|
|
293
320
|
|
|
294
321
|
- Added the `canAddCardToWallet` method. [#986](https://github.com/stripe/stripe-react-native/pull/986).
|
|
295
322
|
|
|
296
|
-
|
|
323
|
+
**Fixes**
|
|
297
324
|
|
|
298
325
|
- Fix build errors on Xcode 14 beta 1 by upgrading `stripe-ios` to `~>22.5.1`. [#1011](https://github.com/stripe/stripe-react-native/pull/1011)
|
|
299
326
|
- Fixed an issue on Android where the `brand` field in `CardField`'s `onCardChange` callback wouldn't be set unless the card details were fully complete. [#1012](https://github.com/stripe/stripe-react-native/pull/1012)
|
|
@@ -303,25 +330,25 @@
|
|
|
303
330
|
|
|
304
331
|
## 0.13.1 - 2022-06-16 (📌 Expo SDK 46)
|
|
305
332
|
|
|
306
|
-
|
|
333
|
+
**Breaking changes**
|
|
307
334
|
|
|
308
|
-
|
|
335
|
+
**Features**
|
|
309
336
|
|
|
310
|
-
|
|
337
|
+
**Fixes**
|
|
311
338
|
|
|
312
339
|
- Never show postal code input in `CardField` if `postalCodeEnabled=false` (regardless of `countryCode`). [#996](https://github.com/stripe/stripe-react-native/pull/996)
|
|
313
340
|
|
|
314
341
|
## 0.13.0 - 2022-06-15
|
|
315
342
|
|
|
316
|
-
|
|
343
|
+
**Breaking changes**
|
|
317
344
|
|
|
318
|
-
|
|
345
|
+
**Features**
|
|
319
346
|
|
|
320
347
|
- Added a `defaultValues` prop to the `CardForm` component. Currently only accepts `countryCode`, and is Android-only. [#974](https://github.com/stripe/stripe-react-native/pull/974)
|
|
321
348
|
- Added the `countryCode` prop to the `CardField` component. [#989](https://github.com/stripe/stripe-react-native/pull/989)
|
|
322
349
|
- Added option to create a PII token (represents the details of personally identifiable information) to the `createToken` method. [#976](https://github.com/stripe/stripe-react-native/pull/976)
|
|
323
350
|
|
|
324
|
-
|
|
351
|
+
**Fixes**
|
|
325
352
|
|
|
326
353
|
- Resolve with an Error (of type `Canceled`) if no payment option is selected in the Payment Sheet custom flow (i.e., the `x` button is clicked to close the Payment Sheet). [#975](https://github.com/stripe/stripe-react-native/pull/975)
|
|
327
354
|
- Fixed an issue on Android where the `complete` field in the `onCardChange` callback would incorrectly be set to `true` even if the postal code wasn't filled out. [#989](https://github.com/stripe/stripe-react-native/pull/989)
|
|
@@ -329,13 +356,13 @@
|
|
|
329
356
|
|
|
330
357
|
## 0.12.0 - 2022-06-02
|
|
331
358
|
|
|
332
|
-
|
|
359
|
+
**Breaking changes**
|
|
333
360
|
|
|
334
361
|
- Renamed `appearance.shapes.shadow.borderRadius` to `appearance.shapes.shadow.blurRadius`, and `appearance.primaryButton.shapes.shadow.borderRadius` to `appearance.primaryButton.shapes.shadow.blurRadius`. [#962](https://github.com/stripe/stripe-react-native/pull/962)
|
|
335
362
|
|
|
336
|
-
|
|
363
|
+
**Features**
|
|
337
364
|
|
|
338
|
-
|
|
365
|
+
**Fixes**
|
|
339
366
|
|
|
340
367
|
- Fixed cases where Android apps would crash with the error: `Unable to instantiate fragment com.reactnativestripesdk.PaymentLauncherFragment`. [#965](https://github.com/stripe/stripe-react-native/pull/965)
|
|
341
368
|
- Fixed `appearance.shapes.shadow.offset` and `appearance.primaryButton.shapes.shadow.offset` not applying the y-coordinate in the correct direction. [#962](https://github.com/stripe/stripe-react-native/pull/962)
|
|
@@ -345,31 +372,31 @@
|
|
|
345
372
|
|
|
346
373
|
## 0.11.0 - 2022-05-24
|
|
347
374
|
|
|
348
|
-
|
|
375
|
+
**Breaking changes**
|
|
349
376
|
|
|
350
377
|
- Removed support for `primaryButtonColor` field on `initPaymentSheet()`. Please use the new `appearance.primaryButton.colors.background` field instead. [#940](https://github.com/stripe/stripe-react-native/pull/940)
|
|
351
378
|
|
|
352
|
-
|
|
379
|
+
**Features**
|
|
353
380
|
|
|
354
381
|
- You can now customize the appearance of your Payment Sheet via the `appearance` field on `initPaymentSheet()`. [#940](https://github.com/stripe/stripe-react-native/pull/940)
|
|
355
382
|
- Added Affirm and AU BECS Direct Debit support to Payment Sheet. [#940](https://github.com/stripe/stripe-react-native/pull/940)
|
|
356
383
|
|
|
357
|
-
|
|
384
|
+
**Fixes**
|
|
358
385
|
|
|
359
386
|
- Improved error messages on Android for failed `confirmPayment` and `confirmSetupIntent` calls, and any Google Pay related methods. [#957](https://github.com/stripe/stripe-react-native/pull/957)
|
|
360
387
|
- Made Android card validation state consistent with iOS in the `CardField` `onCardChange` callback. [#958](https://github.com/stripe/stripe-react-native/pull/958)
|
|
361
388
|
|
|
362
389
|
## 0.10.0 - 2022-05-19
|
|
363
390
|
|
|
364
|
-
|
|
391
|
+
**Breaking changes**
|
|
365
392
|
|
|
366
|
-
|
|
393
|
+
**Features**
|
|
367
394
|
|
|
368
395
|
- Card scanning is available in payment sheet on Android. [#944](https://github.com/stripe/stripe-react-native/pull/944)
|
|
369
396
|
- To enable this, you will need to add `implementation 'com.stripe:stripecardscan:20.3.+'` to your `dependencies {}` block in `android/app/build.gradle`.
|
|
370
397
|
- `us_bank_account` payment method is now available in the payment sheet on Android. [#944](https://github.com/stripe/stripe-react-native/pull/944)
|
|
371
398
|
|
|
372
|
-
|
|
399
|
+
**Fixes**
|
|
373
400
|
|
|
374
401
|
## 0.9.0 - 2022-05-10
|
|
375
402
|
|
package/README.md
CHANGED
|
@@ -228,11 +228,11 @@ jest.mock('@stripe/stripe-react-native', () => mock);
|
|
|
228
228
|
To have a more control over the mocks, you can extend and override particular methods e.g.:
|
|
229
229
|
|
|
230
230
|
```tsx
|
|
231
|
-
const
|
|
231
|
+
const presentNativePayMock = jest.fn();
|
|
232
232
|
|
|
233
233
|
jest.mock('@stripe/stripe-react-native', () => ({
|
|
234
234
|
...mock,
|
|
235
|
-
|
|
235
|
+
presentNativePay: presentNativePayMock,
|
|
236
236
|
}));
|
|
237
237
|
```
|
|
238
238
|
|
|
@@ -15,11 +15,6 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView?>() {
|
|
|
15
15
|
view.initialize()
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
@ReactProp(name = "buttonType")
|
|
19
|
-
fun buttonType(view: GooglePayButtonView, buttonType: String) {
|
|
20
|
-
view.setButtonType(buttonType)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
@ReactProp(name = "type")
|
|
24
19
|
fun type(view: GooglePayButtonView, buttonType: Int) {
|
|
25
20
|
view.setType(buttonType)
|
|
@@ -7,33 +7,21 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
7
7
|
|
|
8
8
|
class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout(context) {
|
|
9
9
|
private var button: View? = null
|
|
10
|
-
// Used in legacy GooglePayButton implementations
|
|
11
|
-
private var buttonType: String? = null
|
|
12
|
-
|
|
13
|
-
// Used in the new PlatformPayButton implementations
|
|
14
10
|
private var type: Int? = null
|
|
15
11
|
|
|
16
12
|
fun initialize() {
|
|
17
13
|
val resAsset: Int =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
else -> R.layout.plain_googlepay_button
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
when (buttonType) {
|
|
33
|
-
"pay" -> R.layout.pay_with_googlepay_button
|
|
34
|
-
"standard" -> R.layout.plain_googlepay_button
|
|
35
|
-
else -> R.layout.plain_googlepay_button
|
|
36
|
-
}
|
|
14
|
+
when (type) {
|
|
15
|
+
0 -> R.layout.plain_googlepay_button
|
|
16
|
+
1 -> R.layout.buy_with_googlepay_button
|
|
17
|
+
6 -> R.layout.book_with_googlepay_button
|
|
18
|
+
5 -> R.layout.checkout_with_googlepay_button
|
|
19
|
+
4 -> R.layout.donate_with_googlepay_button
|
|
20
|
+
11 -> R.layout.order_with_googlepay_button
|
|
21
|
+
1000 -> R.layout.pay_with_googlepay_button
|
|
22
|
+
7 -> R.layout.subscribe_with_googlepay_button
|
|
23
|
+
1001 -> R.layout.googlepay_mark_button
|
|
24
|
+
else -> R.layout.plain_googlepay_button
|
|
37
25
|
}
|
|
38
26
|
|
|
39
27
|
button = LayoutInflater.from(context).inflate(
|
|
@@ -56,10 +44,6 @@ class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout
|
|
|
56
44
|
button?.layout(left, top, right, bottom)
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
fun setButtonType(type: String) {
|
|
60
|
-
buttonType = type
|
|
61
|
-
}
|
|
62
|
-
|
|
63
47
|
fun setType(type: Int) {
|
|
64
48
|
this.type = type
|
|
65
49
|
}
|
|
@@ -34,7 +34,9 @@ class PaymentLauncherFragment(
|
|
|
34
34
|
private val setupIntentClientSecret: String? = null,
|
|
35
35
|
private val confirmSetupParams: ConfirmSetupIntentParams? = null,
|
|
36
36
|
// Used when handling the next action on a payment intent
|
|
37
|
-
private val
|
|
37
|
+
private val handleNextActionPaymentIntentClientSecret: String? = null,
|
|
38
|
+
// Used when handling the next action on a setup intent
|
|
39
|
+
private val handleNextActionSetupIntentClientSecret: String? = null,
|
|
38
40
|
) : Fragment() {
|
|
39
41
|
private lateinit var paymentLauncher: PaymentLauncher
|
|
40
42
|
|
|
@@ -88,19 +90,40 @@ class PaymentLauncherFragment(
|
|
|
88
90
|
/**
|
|
89
91
|
* Helper-constructor used for handling the next action on a payment intent
|
|
90
92
|
*/
|
|
91
|
-
fun
|
|
93
|
+
fun forNextActionPayment(context: ReactApplicationContext,
|
|
92
94
|
stripe: Stripe,
|
|
93
95
|
publishableKey: String,
|
|
94
96
|
stripeAccountId: String?,
|
|
95
97
|
promise: Promise,
|
|
96
|
-
|
|
98
|
+
handleNextActionPaymentIntentClientSecret: String): PaymentLauncherFragment {
|
|
97
99
|
val paymentLauncherFragment = PaymentLauncherFragment(
|
|
98
100
|
context,
|
|
99
101
|
stripe,
|
|
100
102
|
publishableKey,
|
|
101
103
|
stripeAccountId,
|
|
102
104
|
promise,
|
|
103
|
-
|
|
105
|
+
handleNextActionPaymentIntentClientSecret = handleNextActionPaymentIntentClientSecret,
|
|
106
|
+
)
|
|
107
|
+
addFragment(paymentLauncherFragment, context, promise)
|
|
108
|
+
return paymentLauncherFragment
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Helper-constructor used for handling the next action on a setup intent
|
|
113
|
+
*/
|
|
114
|
+
fun forNextActionSetup(context: ReactApplicationContext,
|
|
115
|
+
stripe: Stripe,
|
|
116
|
+
publishableKey: String,
|
|
117
|
+
stripeAccountId: String?,
|
|
118
|
+
promise: Promise,
|
|
119
|
+
handleNextActionSetupIntentClientSecret: String): PaymentLauncherFragment {
|
|
120
|
+
val paymentLauncherFragment = PaymentLauncherFragment(
|
|
121
|
+
context,
|
|
122
|
+
stripe,
|
|
123
|
+
publishableKey,
|
|
124
|
+
stripeAccountId,
|
|
125
|
+
promise,
|
|
126
|
+
handleNextActionSetupIntentClientSecret = handleNextActionSetupIntentClientSecret,
|
|
104
127
|
)
|
|
105
128
|
addFragment(paymentLauncherFragment, context, promise)
|
|
106
129
|
return paymentLauncherFragment
|
|
@@ -130,8 +153,10 @@ class PaymentLauncherFragment(
|
|
|
130
153
|
paymentLauncher.confirm(confirmPaymentParams)
|
|
131
154
|
} else if (setupIntentClientSecret != null && confirmSetupParams != null) {
|
|
132
155
|
paymentLauncher.confirm(confirmSetupParams)
|
|
133
|
-
} else if (
|
|
134
|
-
paymentLauncher.handleNextActionForPaymentIntent(
|
|
156
|
+
} else if (handleNextActionPaymentIntentClientSecret != null) {
|
|
157
|
+
paymentLauncher.handleNextActionForPaymentIntent(handleNextActionPaymentIntentClientSecret)
|
|
158
|
+
} else if (handleNextActionSetupIntentClientSecret != null) {
|
|
159
|
+
paymentLauncher.handleNextActionForSetupIntent(handleNextActionSetupIntentClientSecret)
|
|
135
160
|
} else {
|
|
136
161
|
throw Exception("Invalid parameters provided to PaymentLauncher. Ensure that you are providing the correct client secret and setup params (if necessary).")
|
|
137
162
|
}
|
|
@@ -146,10 +171,12 @@ class PaymentLauncherFragment(
|
|
|
146
171
|
is PaymentResult.Completed -> {
|
|
147
172
|
if (paymentIntentClientSecret != null) {
|
|
148
173
|
retrievePaymentIntent(paymentIntentClientSecret, stripeAccountId)
|
|
149
|
-
} else if (
|
|
150
|
-
retrievePaymentIntent(
|
|
174
|
+
} else if (handleNextActionPaymentIntentClientSecret != null) {
|
|
175
|
+
retrievePaymentIntent(handleNextActionPaymentIntentClientSecret, stripeAccountId)
|
|
151
176
|
} else if (setupIntentClientSecret != null) {
|
|
152
177
|
retrieveSetupIntent(setupIntentClientSecret, stripeAccountId)
|
|
178
|
+
} else if (handleNextActionSetupIntentClientSecret != null) {
|
|
179
|
+
retrieveSetupIntent(handleNextActionSetupIntentClientSecret, stripeAccountId)
|
|
153
180
|
} else {
|
|
154
181
|
throw Exception("Failed to create Payment Launcher. No client secret provided.")
|
|
155
182
|
}
|