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

[Feature] Change Call-To-Action when storing credit cards #1646

Open
miklselsoe opened this issue Apr 25, 2024 · 5 comments
Open

[Feature] Change Call-To-Action when storing credit cards #1646

miklselsoe opened this issue Apr 25, 2024 · 5 comments

Comments

@miklselsoe
Copy link

We have a flow where we allow users to store a credit card for later use in our app. It would be nice if the CTA on the button was something other than "Pay" since the user is not actually paying anything at this point.

image

I haven't found a way to change the CTA (to ex. "Save"). It would be really nice to have this option when storing credit cards.

We are using a styled CardComponent.

@erenbesel
Copy link
Contributor

erenbesel commented Apr 25, 2024

Hi @miklselsoe
There is currently no way to change the title of the pay button programmatically.

However, since you can override the localization files of the SDK, you can change the title for each key. See localization

We will discuss to make it programmatic in the future.

Hope this helps!

@miklselsoe
Copy link
Author

Thanks. We still need it to say "Pay" in other scenarios, so I don't think the custom localization will work, but maybe a list of predefined CTA's to choose from would be nice.

@erenbesel
Copy link
Contributor

If the scenario you want to change the title is for 0 amounts, you can still use the localization route.
There is a total of 3 different scenarios for the button's title in CardComponent, each involving the amount property in adyenContext.payment object. See this function and below for each of possibilities.

Maybe the 0 amount option suits your case and you can override the related localization key.

@miklselsoe
Copy link
Author

Thank you! I understand it a bit better now and think I can make it work with custom localization although it's not too pretty.

I don't know how to use the function you refer to in the Localization.swift file. I only can find reference to LocalizationParameters on the CardComponent.Configuration, but not how or when the localizedSubmitButtonTitle is called? Should I call it or override it, if so when and how?

@erenbesel
Copy link
Contributor

I meant still overriding the localized keys but linked the logic we use to determine which localized key we are using for which case. (not meant for you to use the function directly)
If your case fits the 0 amount block in that function, that's the key you can override only (confirmPreauthorization) and rest will be the default titles that we set.

Hope it's more clear now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants