Skip to content

Commit

Permalink
[ios] add support for removeSavedPaymentMethodMessage for payment she…
Browse files Browse the repository at this point in the history
…et (#1498)

* [ios] add support for removeSavedPaymentMethodMessage for payment sheet

* [skip actions] changelog
  • Loading branch information
charliecruzan-stripe authored Sep 13, 2023
1 parent 89907c7 commit 8463c92
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
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

0 comments on commit 8463c92

Please sign in to comment.