Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios] add support for removeSavedPaymentMethodMessage for payment sheet #1498

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
1 change: 1 addition & 0 deletions example/src/screens/PaymentsUICompleteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function PaymentsUICompleteScreen() {
allowsDelayedPaymentMethods: true,
appearance,
primaryButtonLabel: 'purchase!',
removeSavedPaymentMethodMessage: 'remove this payment method?',
});
if (!error) {
setPaymentSheetEnabled(true);
Expand Down
4 changes: 4 additions & 0 deletions ios/StripeSdk+PaymentSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/types/PaymentSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down