From 448c6041078da0f3a62126bea1f7838b79a81e8c Mon Sep 17 00:00:00 2001 From: Charlie Cruzan Date: Tue, 12 Sep 2023 12:28:00 -1000 Subject: [PATCH 1/2] [ios] add support for removeSavedPaymentMethodMessage for payment sheet --- example/src/screens/PaymentsUICompleteScreen.tsx | 1 + ios/StripeSdk+PaymentSheet.swift | 4 ++++ src/types/PaymentSheet.ts | 2 ++ 3 files changed, 7 insertions(+) diff --git a/example/src/screens/PaymentsUICompleteScreen.tsx b/example/src/screens/PaymentsUICompleteScreen.tsx index b7be7a6ee..a402b4243 100644 --- a/example/src/screens/PaymentsUICompleteScreen.tsx +++ b/example/src/screens/PaymentsUICompleteScreen.tsx @@ -110,6 +110,7 @@ export default function PaymentsUICompleteScreen() { allowsDelayedPaymentMethods: true, appearance, primaryButtonLabel: 'purchase!', + removeSavedPaymentMethodMessage: 'remove this payment method?', }); if (!error) { setPaymentSheetEnabled(true); diff --git a/ios/StripeSdk+PaymentSheet.swift b/ios/StripeSdk+PaymentSheet.swift index cf50b7d34..b7dd3b1ff 100644 --- a/ios/StripeSdk+PaymentSheet.swift +++ b/ios/StripeSdk+PaymentSheet.swift @@ -50,6 +50,10 @@ extension StripeSdk { configuration.allowsDelayedPaymentMethods = allowsDelayedPaymentMethods } + if let removeSavedPaymentMethodMessage = params["removeSavedPaymentMethodMessage"] as? String { + configuration.removeSavedPaymentMethodMessage = removeSavedPaymentMethodMessage + } + if let billingConfigParams = params["billingDetailsCollectionConfiguration"] as? [String: Any?] { configuration.billingDetailsCollectionConfiguration.name = StripeSdk.mapToCollectionMode(str: billingConfigParams["name"] as? String) configuration.billingDetailsCollectionConfiguration.phone = StripeSdk.mapToCollectionMode(str: billingConfigParams["phone"] as? String) diff --git a/src/types/PaymentSheet.ts b/src/types/PaymentSheet.ts index 0401b56ea..18e1bb03f 100644 --- a/src/types/PaymentSheet.ts +++ b/src/types/PaymentSheet.ts @@ -50,6 +50,8 @@ export type SetupParams = IntentParams & { appearance?: AppearanceParams; /** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */ primaryButtonLabel?: string; + /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */ + removeSavedPaymentMethodMessage?: string; }; export type IntentParams = From 4ff6372be18e18031e21a3c7e709186cd0c46ce6 Mon Sep 17 00:00:00 2001 From: Charlie Cruzan Date: Tue, 12 Sep 2023 12:29:58 -1000 Subject: [PATCH 2/2] [skip actions] changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb7056fc6..aa944cbf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ ## Unreleased -## 0.31.0 - 2023-09-08 +**Features** + +- [PaymentSheet] Added the `removeSavedPaymentMethodMessage` field to `initPaymentSheet` to display a custom message when a saved payment method is removed. iOS Only. [#1498](https://github.com/stripe/stripe-react-native/pull/1498) + +## 0.31.1 - 2023-09-08 **Features**