@stripe/stripe-react-native 0.29.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +84 -71
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +35 -8
  4. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +13 -1
  5. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +8 -1
  6. package/ios/Mappers.swift +1 -0
  7. package/ios/StripeSdk.m +7 -0
  8. package/ios/StripeSdk.swift +32 -0
  9. package/jest/mock.js +4 -0
  10. package/lib/commonjs/NativeStripeSdk.js.map +1 -1
  11. package/lib/commonjs/functions.js +1 -1
  12. package/lib/commonjs/functions.js.map +1 -1
  13. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +1 -1
  14. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
  15. package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
  16. package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
  17. package/lib/commonjs/hooks/useStripe.js +1 -1
  18. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  19. package/lib/commonjs/types/PushProvisioning.js.map +1 -1
  20. package/lib/commonjs/types/index.js.map +1 -1
  21. package/lib/module/NativeStripeSdk.js.map +1 -1
  22. package/lib/module/functions.js +1 -1
  23. package/lib/module/functions.js.map +1 -1
  24. package/lib/module/hooks/useFinancialConnectionsSheet.js +1 -1
  25. package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
  26. package/lib/module/hooks/usePaymentSheet.js +1 -1
  27. package/lib/module/hooks/usePaymentSheet.js.map +1 -1
  28. package/lib/module/hooks/useStripe.js +1 -1
  29. package/lib/module/hooks/useStripe.js.map +1 -1
  30. package/lib/module/types/PushProvisioning.js.map +1 -1
  31. package/lib/module/types/index.js.map +1 -1
  32. package/lib/typescript/src/NativeStripeSdk.d.ts +2 -1
  33. package/lib/typescript/src/functions.d.ts +8 -1
  34. package/lib/typescript/src/hooks/useStripe.d.ts +2 -1
  35. package/lib/typescript/src/types/PushProvisioning.d.ts +9 -1
  36. package/lib/typescript/src/types/index.d.ts +7 -0
  37. package/package.json +1 -1
  38. package/src/NativeStripeSdk.tsx +5 -0
  39. package/src/functions.ts +36 -0
  40. package/src/hooks/useFinancialConnectionsSheet.tsx +19 -13
  41. package/src/hooks/usePaymentSheet.tsx +25 -18
  42. package/src/hooks/useStripe.tsx +13 -0
  43. package/src/types/PushProvisioning.ts +9 -1
  44. package/src/types/index.ts +10 -0
  45. package/stripe-react-native.podspec +1 -1
package/CHANGELOG.md CHANGED
@@ -2,34 +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
+
5
18
  ## 0.29.0 - 2023-07-13
6
19
 
7
- ### Breaking changes
20
+ **Breaking changes**
8
21
 
9
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)
10
23
 
11
- ## Features
24
+ **Features**
12
25
 
13
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)
14
27
 
15
- ## Fixes
28
+ **Fixes**
16
29
 
17
30
  - Fixes `handleURLCallback` to only take action on iOS, no-op on Android. [#1423](https://github.com/stripe/stripe-react-native/pull/1423)
18
31
 
19
32
  ## 0.28.0 - 2023-06-16
20
33
 
21
- ## Features
34
+ **Features**
22
35
 
23
- - 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)
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)
24
37
 
25
- ## Fixes
38
+ **Fixes**
26
39
 
27
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)
28
- - Resolve with better error objects on iOS in `confirmPaymentSheetPayment`, `createTokenForCVCUpdate`, `createPaymentMethod`, `retrievePaymentIntent`, and `retrieveSetupIntent` [#1399](https://github.com/stripe/stripe-react-native/pull/1399)
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)
29
42
 
30
43
  ## 0.27.2 - 2023-05-15
31
44
 
32
- ## Fixes
45
+ **Fixes**
33
46
 
34
47
  - Updated `stripe-android` from 20.24.0 to 20.25.+ [#1384](https://github.com/stripe/stripe-react-native/pull/1384)
35
48
  - Updated `stripe-ios` from 23.7.+ to 23.8.+ [#1384](https://github.com/stripe/stripe-react-native/pull/1384)
@@ -38,7 +51,7 @@
38
51
 
39
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.
40
53
 
41
- ## Fixes
54
+ **Fixes**
42
55
 
43
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)
44
57
  - Fixed `AddToWalletButton` not properly resolving the `androidAssetSource` in release mode. [#1373](https://github.com/stripe/stripe-react-native/pull/1373)
@@ -46,11 +59,11 @@
46
59
 
47
60
  ## 0.27.0 - 2023-04-21
48
61
 
49
- ### Features
62
+ **Features**
50
63
 
51
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)
52
65
 
53
- ### Fixes
66
+ **Fixes**
54
67
 
55
68
  - Updated Google Pay button asset to match Google's most recent branding guidelines. [#1343](https://github.com/stripe/stripe-react-native/pull/1343)
56
69
  - Fixed type for `ApplePay.ShippingContact.phoneNumber`. [#1349](https://github.com/stripe/stripe-react-native/pull/1349)
@@ -58,21 +71,21 @@
58
71
 
59
72
  ## 0.26.0 - 2023-03-16
60
73
 
61
- ### New Features
74
+ **Features**
62
75
 
63
76
  - Added support for PayPal and CashApp to PaymentSheet, `confirmPayment`, and `confirmSetupIntent`. [#1331](https://github.com/stripe/stripe-react-native/pull/1331)
64
77
 
65
- ### Fixes
78
+ **Fixes**
66
79
 
67
80
  - Compatible with v0.1.4 of `@stripe/stripe-identity-react-native`. [8fa8a7a](https://github.com/stripe/stripe-react-native/commit/8fa8a7a0595a31d7422af6bbe26d696ba5e211f7)
68
81
 
69
82
  ## 0.25.0 - 2023-02-27
70
83
 
71
- ### New Features
84
+ **Features**
72
85
 
73
86
  - Added the `supportsTapToPay` option to `canAddCardToWallet`. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)
74
87
 
75
- ### Fixes
88
+ **Fixes**
76
89
 
77
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)
78
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)
@@ -81,9 +94,9 @@
81
94
 
82
95
  ## 0.24.0 - 2023-02-17
83
96
 
84
- ### Breaking changes
97
+ **Breaking changes**
85
98
 
86
- - [#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:
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:
87
100
 
88
101
  ```diff
89
102
  initPaymentSheet({
@@ -96,22 +109,22 @@
96
109
  })
97
110
  ```
98
111
 
99
- ### New Features
112
+ **Features**
100
113
 
101
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)
102
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)
103
- - 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)
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)
104
117
  - Added an `options` argument to `presentPaymentSheet` which includes a `timeout` property. [#1287](https://github.com/stripe/stripe-react-native/pull/1287)
105
118
 
106
119
  ## 0.23.3 - 2023-02-07 (📌 Expo SDK 48)
107
120
 
108
- ### Fixes
121
+ **Fixes**
109
122
 
110
123
  - Fixes a build failure on Android when using `stripe-android` v20.19.2. [#1289](https://github.com/stripe/stripe-react-native/pull/1289)
111
124
 
112
125
  ## 0.23.2 - 2023-02-06
113
126
 
114
- ### Fixes
127
+ **Fixes**
115
128
 
116
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)
117
130
 
@@ -119,7 +132,7 @@
119
132
 
120
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).
121
134
 
122
- ### Fixes
135
+ **Fixes**
123
136
 
124
137
  - Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
125
138
  - Fixed types so that Klarna accepts the `shippingDetails` property. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
@@ -127,12 +140,12 @@
127
140
 
128
141
  ## 0.23.0 - 2023-01-09
129
142
 
130
- ### Breaking changes
143
+ **Breaking changes**
131
144
 
132
145
  - `createPlatformPayPaymentMethod` no longer returns a `token` object. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
133
146
  - If your integration depends on Stripe's Tokens API, please use `createPlatformPayToken`, which accepts identical arguments.
134
147
 
135
- ### Fixes
148
+ **Fixes**
136
149
 
137
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)
138
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)
@@ -141,7 +154,7 @@
141
154
 
142
155
  ## 0.22.1 - 2022-12-07
143
156
 
144
- ### Fixes
157
+ **Fixes**
145
158
 
146
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)
147
160
  - Fixed the `ShippingMethod` type to contain the `startDate` and `endDate` keys, if applicable. [#1227](https://github.com/stripe/stripe-react-native/pull/1227)
@@ -150,14 +163,14 @@
150
163
 
151
164
  ## 0.22.0 - 2022-12-02
152
165
 
153
- ### Breaking changes
166
+ **Breaking changes**
154
167
 
155
- ### New features
168
+ **Features**
156
169
 
157
170
  - Added the `hasPairedAppleWatch` option to `canAddCardToWallet`. [#1219](https://github.com/stripe/stripe-react-native/pull/1219)
158
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.
159
172
 
160
- ### Fixes
173
+ **Fixes**
161
174
 
162
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)
163
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)
@@ -166,25 +179,25 @@
166
179
 
167
180
  ## 0.21.0 - 2022-11-15
168
181
 
169
- ### Breaking changes
182
+ **Breaking changes**
170
183
 
171
- ### New features
184
+ **Features**
172
185
 
173
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)
174
187
  - [Find the docs here](https://stripe.com/docs/elements/address-element?platform=react-native)
175
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)
176
189
 
177
- ### Fixes
190
+ **Fixes**
178
191
 
179
192
  - Fixed a build error on Android when using Kotlin version 1.7.10. [#1195](https://github.com/stripe/stripe-react-native/pull/1195)
180
193
 
181
194
  ## 0.20.0 - 2022-11-03
182
195
 
183
- ### Breaking changes
196
+ **Breaking changes**
184
197
 
185
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)
186
199
 
187
- ### New features
200
+ **Features**
188
201
 
189
202
  - Added [Link](https://stripe.com/docs/payments/link) support in Payment Sheet. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
190
203
  - Added the `resetPaymentSheetCustomer` method to clear persisted authentication state in the PaymentSheet. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
@@ -192,7 +205,7 @@
192
205
  - Added support for custom fonts to `CardForm` and `CardView` on Android. [#1150](https://github.com/stripe/stripe-react-native/pull/1150)
193
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)
194
207
 
195
- ### Fixes
208
+ **Fixes**
196
209
 
197
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)
198
211
  - Upgraded `stripe-android` to 20.15.+. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
@@ -203,16 +216,16 @@
203
216
 
204
217
  ## 0.19.0 - 2022-09-16 (📌 Expo SDK 47)
205
218
 
206
- ### Breaking changes
219
+ **Breaking changes**
207
220
 
208
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)
209
222
  - Your `compileSdkVersion` (in `android/build.gradle`) now must be at least 33. Changing your `compileSdkVersion` does not change runtime behavior.
210
223
 
211
- ### New features
224
+ **Features**
212
225
 
213
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)
214
227
 
215
- ### Fixes
228
+ **Fixes**
216
229
 
217
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)
218
231
  - Fix Expo Config Plugin support on SDK 46. [#1111](https://github.com/stripe/stripe-react-native/pull/1111)
@@ -220,39 +233,39 @@
220
233
 
221
234
  ## 0.18.1 - 2022-08-19
222
235
 
223
- ### Breaking changes
236
+ **Breaking changes**
224
237
 
225
- ### New features
238
+ **Features**
226
239
 
227
- ### Fixes
240
+ **Fixes**
228
241
 
229
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).
230
243
 
231
244
  ## 0.18.0 - 2022-08-17
232
245
 
233
- ### Breaking changes
246
+ **Breaking changes**
234
247
 
235
248
  - Your `compileSdkVersion` (in `android/build.gradle`) now must be at least `32`. Changing your `compileSdkVersion` does not change runtime behavior.
236
249
 
237
- ### New features
250
+ **Features**
238
251
 
239
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)
240
253
  - Payment Sheet now supports Link on iOS. [#1086](https://github.com/stripe/stripe-react-native/pull/1086).
241
254
 
242
- ### Fixes
255
+ **Fixes**
243
256
 
244
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).
245
258
  - Upgraded `stripe-ios` to 22.7.+ and `stripe-android` to 20.9.+.
246
259
 
247
260
  ## 0.17.0 - 2022-08-11
248
261
 
249
- ### Breaking changes
262
+ **Breaking changes**
250
263
 
251
- ### New features
264
+ **Features**
252
265
 
253
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.
254
267
 
255
- ### Fixes
268
+ **Fixes**
256
269
 
257
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)
258
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)
@@ -260,25 +273,25 @@
260
273
 
261
274
  ## 0.16.0 - 2022-07-22
262
275
 
263
- ### Breaking changes
276
+ **Breaking changes**
264
277
 
265
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)
266
279
 
267
- ### New features
280
+ **Features**
268
281
 
269
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)
270
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)
271
284
 
272
- ### Fixes
285
+ **Fixes**
273
286
 
274
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)
275
288
 
276
289
  ## 0.15.0 - 2022-07-14
277
290
 
278
- ### Breaking changes
291
+ **Breaking changes**
279
292
 
280
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)`:
281
- - **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 "New features" below).
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).
282
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.
283
296
  - Since the `merchantCountryCode` field now lives under the `applePay` and `googlePay` objects, it has been removed from the base `params` object.
284
297
  - Similarly, since the `currencyCode` and `testEnv` fields now live under the `googlePay` object, they have been removed from the base `params` object .
@@ -287,13 +300,13 @@
287
300
  - The same change was made to `ApplePay.ShippingMethod`: renamed `type` to `isPending`.
288
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).
289
302
 
290
- ### New features
303
+ **Features**
291
304
 
292
305
  - Added support for iOS 15 `paymentSummaryItems`: `PKDeferredPaymentSummaryItem` and `PKRecurringPaymentSummaryItem`.
293
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)
294
307
  - Added support for Affirm (previously, Affirm was only available in the Payment Sheet). [1036](https://github.com/stripe/stripe-react-native/pull/1036)
295
308
 
296
- ### Fixes
309
+ **Fixes**
297
310
 
298
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).
299
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)
@@ -301,13 +314,13 @@
301
314
 
302
315
  ## 0.14.0 - 2022-06-30
303
316
 
304
- ### Breaking changes
317
+ **Breaking changes**
305
318
 
306
- ### New features
319
+ **Features**
307
320
 
308
321
  - Added the `canAddCardToWallet` method. [#986](https://github.com/stripe/stripe-react-native/pull/986).
309
322
 
310
- ### Fixes
323
+ **Fixes**
311
324
 
312
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)
313
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)
@@ -317,25 +330,25 @@
317
330
 
318
331
  ## 0.13.1 - 2022-06-16 (📌 Expo SDK 46)
319
332
 
320
- ### Breaking changes
333
+ **Breaking changes**
321
334
 
322
- ### New features
335
+ **Features**
323
336
 
324
- ### Fixes
337
+ **Fixes**
325
338
 
326
339
  - Never show postal code input in `CardField` if `postalCodeEnabled=false` (regardless of `countryCode`). [#996](https://github.com/stripe/stripe-react-native/pull/996)
327
340
 
328
341
  ## 0.13.0 - 2022-06-15
329
342
 
330
- ### Breaking changes
343
+ **Breaking changes**
331
344
 
332
- ### New features
345
+ **Features**
333
346
 
334
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)
335
348
  - Added the `countryCode` prop to the `CardField` component. [#989](https://github.com/stripe/stripe-react-native/pull/989)
336
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)
337
350
 
338
- ### Fixes
351
+ **Fixes**
339
352
 
340
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)
341
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)
@@ -343,13 +356,13 @@
343
356
 
344
357
  ## 0.12.0 - 2022-06-02
345
358
 
346
- ### Breaking changes
359
+ **Breaking changes**
347
360
 
348
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)
349
362
 
350
- ### New features
363
+ **Features**
351
364
 
352
- ### Fixes
365
+ **Fixes**
353
366
 
354
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)
355
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)
@@ -359,31 +372,31 @@
359
372
 
360
373
  ## 0.11.0 - 2022-05-24
361
374
 
362
- ### Breaking changes
375
+ **Breaking changes**
363
376
 
364
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)
365
378
 
366
- ### New features
379
+ **Features**
367
380
 
368
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)
369
382
  - Added Affirm and AU BECS Direct Debit support to Payment Sheet. [#940](https://github.com/stripe/stripe-react-native/pull/940)
370
383
 
371
- ### Fixes
384
+ **Fixes**
372
385
 
373
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)
374
387
  - Made Android card validation state consistent with iOS in the `CardField` `onCardChange` callback. [#958](https://github.com/stripe/stripe-react-native/pull/958)
375
388
 
376
389
  ## 0.10.0 - 2022-05-19
377
390
 
378
- ### Breaking changes
391
+ **Breaking changes**
379
392
 
380
- ### New features
393
+ **Features**
381
394
 
382
395
  - Card scanning is available in payment sheet on Android. [#944](https://github.com/stripe/stripe-react-native/pull/944)
383
396
  - To enable this, you will need to add `implementation 'com.stripe:stripecardscan:20.3.+'` to your `dependencies {}` block in `android/app/build.gradle`.
384
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)
385
398
 
386
- ### Fixes
399
+ **Fixes**
387
400
 
388
401
  ## 0.9.0 - 2022-05-10
389
402
 
@@ -1,3 +1,3 @@
1
1
  StripeSdk_kotlinVersion=1.8.0
2
2
  # Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
3
- StripeSdk_stripeVersion=20.27.+
3
+ StripeSdk_stripeVersion=20.28.+
@@ -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 handleNextActionClientSecret: String? = null,
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 forNextAction(context: ReactApplicationContext,
93
+ fun forNextActionPayment(context: ReactApplicationContext,
92
94
  stripe: Stripe,
93
95
  publishableKey: String,
94
96
  stripeAccountId: String?,
95
97
  promise: Promise,
96
- handleNextActionClientSecret: String): PaymentLauncherFragment {
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
- handleNextActionClientSecret = handleNextActionClientSecret,
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 (handleNextActionClientSecret != null) {
134
- paymentLauncher.handleNextActionForPaymentIntent(handleNextActionClientSecret)
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 (handleNextActionClientSecret != null) {
150
- retrievePaymentIntent(handleNextActionClientSecret, stripeAccountId)
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
  }
@@ -406,7 +406,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
406
406
 
407
407
  @ReactMethod
408
408
  fun handleNextAction(paymentIntentClientSecret: String, promise: Promise) {
409
- paymentLauncherFragment = PaymentLauncherFragment.forNextAction(
409
+ paymentLauncherFragment = PaymentLauncherFragment.forNextActionPayment(
410
410
  context = reactApplicationContext,
411
411
  stripe,
412
412
  publishableKey,
@@ -416,6 +416,18 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
416
416
  )
417
417
  }
418
418
 
419
+ @ReactMethod
420
+ fun handleNextActionForSetup(setupIntentClientSecret: String, promise: Promise) {
421
+ paymentLauncherFragment = PaymentLauncherFragment.forNextActionSetup(
422
+ context = reactApplicationContext,
423
+ stripe,
424
+ publishableKey,
425
+ stripeAccountId,
426
+ promise,
427
+ setupIntentClientSecret
428
+ )
429
+ }
430
+
419
431
  // TODO: Uncomment when WeChat is re-enabled in stripe-ios
420
432
  // private fun payWithWeChatPay(paymentIntentClientSecret: String, appId: String) {
421
433
  // val activity = currentActivity as ComponentActivity
@@ -91,9 +91,16 @@ object TapAndPayProxy {
91
91
  result.putString(
92
92
  "id",
93
93
  tokenInfoClass.getMethod("getIssuerTokenId").invoke(it) as String)
94
+ val fpan = tokenInfoClass.getMethod("getFpanLastFour").invoke(it) as String
94
95
  result.putString(
95
96
  "cardLastFour",
96
- tokenInfoClass.getMethod("getFpanLastFour").invoke(it) as String)
97
+ fpan)
98
+ result.putString(
99
+ "fpanLastFour",
100
+ fpan)
101
+ result.putString(
102
+ "dpanLastFour",
103
+ tokenInfoClass.getMethod("getDpanLastFour").invoke(it) as String)
97
104
  result.putString(
98
105
  "issuer",
99
106
  tokenInfoClass.getMethod("getIssuerName").invoke(it) as String)
package/ios/Mappers.swift CHANGED
@@ -357,6 +357,7 @@ class Mappers {
357
357
  if let address = shipping.address {
358
358
  addressDetails = [
359
359
  "city": address.city ?? NSNull(),
360
+ "state": address.state ?? NSNull(),
360
361
  "country": address.country ?? NSNull(),
361
362
  "line1": address.line1 ?? NSNull(),
362
363
  "line2":address.line2 ?? NSNull(),
package/ios/StripeSdk.m CHANGED
@@ -93,6 +93,13 @@ RCT_EXTERN_METHOD(
93
93
  rejecter: (RCTPromiseRejectBlock)reject
94
94
  )
95
95
 
96
+ RCT_EXTERN_METHOD(
97
+ handleNextActionForSetup:(NSString *)setupIntentClientSecret
98
+ returnURL:(NSString *)returnURL
99
+ resolver: (RCTPromiseResolveBlock)resolve
100
+ rejecter: (RCTPromiseRejectBlock)reject
101
+ )
102
+
96
103
  RCT_EXTERN_METHOD(
97
104
  initPaymentSheet:(NSDictionary *)params
98
105
  resolver: (RCTPromiseResolveBlock)resolve