stripe-android
stripe-android copied to clipboard
[Feature] Make the postal code and country/region optional for credit card entry, in new payment sheet ui
Is your feature request related to a problem? Please describe.
The prebuilt-ui multi-step: https://stripe.com/docs/payments/accept-a-payment?platform=android&ui=payment-sheet-custom credit card entry form requires country/region and postal code fields. This used to be optional, but now is required. We want it to be optional.
- In our payment flow, the user already provides their address (including country/region and postal code) in our own form
- In the old Stripe UI, when adding a card, it was possible to limit the card entry fields to card number, expiration date, cvv
- In the new payment sheet UI (multi-step), the card entry form has country/region and postal code fields that can't be removed.
Describe the solution you'd like We would like to stay current and use the latest payment sheet UI provided by Stripe, but we don't want to make our users input the postal code and country/region twice.
Describe alternatives you've considered An alternative is to not update to the payment sheet UI and continue using the old UI.
Additional context
Our flow using the new payment sheet UI:
The flow using the old UI:
Additional info:
The new ui isn't customizable regarding the postal code: https://github.com/stripe/stripe-android/blob/v16.8.0/stripe/src/main/java/com/stripe/android/paymentsheet/ui/BillingAddressView.kt#L290
private fun updatePostalCodeView(countryCode: CountryCode?) {
val shouldShowPostalCode = countryCode == null ||
CountryUtils.doesCountryUsePostalCode(countryCode)
postalCodeLayout.isVisible = shouldShowPostalCode
val shouldShowPostalCodeContainer =
level == BillingAddressCollectionLevel.Required || shouldShowPostalCode
It's hardcoded to show the postal code if the provided country is null or if the country itself has postal codes
The old UI is customizable:
https://github.com/stripe/stripe-android/blob/v16.8.0/stripe/src/main/java/com/stripe/android/view/PaymentMethodsActivityStarter.kt#L74
To disable the postal code, you can use setBillingAddressFields
as follows:
PaymentMethodsActivityStarter.Args.Builder().setBillingAddressFields(BillingAddressFields.None)
Thanks for writing in and the feedback. We have this in our backlog and will provide an update when it is ready.
Hey @calvarez-ov,
We're working on adding the ability for you to pre-fill billing details in the sheet, like country and postal code. This means that when the sheet appears, it will have those fields filled out with the values you provide.
Does that work for your use case? Your feedback is appreciated!
@yuki-stripe do you have a date on when this feature will be available ?
@yuki-stripe Sorry I completely missed your question!
I'll get in touch with the PO and report back here.
From my POV, I'm thinking it would be best if we could not show the fields at all, if we're just going to use the values they entered in our own screen. I don't know how we would handle it if the user put different values in the card entry screen compared to our own payment screen. Would really be better to just not have this in the card input screen. A simpler UI would be better for the user.
But i'll come back here with the input from the PO.
I talked with our PO.
This isn't the ideal solution we were hoping for. But it could be enough.
We could accept showing these fields if they're pre-filled.
However, if the user first enters the card (with these two fields), and then comes back to our own billing screen, we won't retrieve/use the values from the card input. In this case, the user will still have to enter the fields twice.
One thing: We may have some issues if we have different rules enforcing valid postal code formats in our own screen vs the stripe credit card screen.
Could you let us know what is the validation/format for the postal code?
@yuki-stripe wouldn't it a better if we have the option the disable country and postal code/zip code?
my customers are in UAE. when the payment sheet opens it displays the UK with postal code text Field. Is it possible to disable it or is it possible to set UAE by default? By the way, I am using flutter_stripe plugin.
Hi, could I add something on the original request? We are a fintech and want to operate in Spain. The Spanish regulator is asking us to request Full Name only (we don't need postal code nor Country). Can the UI be flexible enough so we can configure the data we want to request our users ? (in our case, card details + Full name).
Thanks.
@yuki-stripe Do you have any update on this request ?
Still waiting on this. I hope it's not an abandoned request. Anyone any update on how to hide the Country/Region UI?
Hello, this is available as of today on v20.23.