#mykhaelo_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1445045966901219329
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐ Just taking a look to see if there is a way to do this, bear with me a moment
Afraid it doesn't look like it's possible to pre-select fields inside this element
Hi there ๐ jumping in as my teammate needs to step away soon.
When creating the Payment Element, you can use the defaultValues option to set the default values that are shown to the customer:
https://docs.stripe.com/js/elements_object/create_payment_element#payment_element_create-options-defaultValues
But let me know if that doesn't do what you're hoping.
Looking
It does not work
I made
stripePayByBank.current = createStripePayByBank(stripeElements.current, {
defaultValues: {
billingDetails: {
address: {
country: "fr"
}
}
}
})
Banks are german on checkot page
What is createStripePayByBank? I don't think that's one of our functions.
export const createStripePayByBank = (
stripeElements?: {
create: (type: string, style: object) => object
},
options?
) => {
if (stripeElements) {
return stripeElements.create('payment', options)
}
}
Can you share the full screenshot of the Payment Element? Is there a country field shown at all?
There is not country field, user need to click on the other bank, then select the country
a one country from the list I want to preselect
Ah, I don't think that is prefillable then. Sorry, I thought the Payment Element itself was surfacing a country field, not that it was within the next modal. I can definitely undewrstand the benefit of being able to set that though, and plan to file feedback with the appropriate team suggesting an improvement here. To faciliate that, can you tell me a bit more about the behavior you're seeing, primarily which country is selected by default? (I can't really tell from that UI ๐ , looks like nothing is selected)
Oh, do you have access to a private preview for this payment method? I think that may be why my teammates and I aren't familiar with this offhand.
There is Germany selected on this Element, (on the first screen shot you can see only german banks. ) .
I don't think I have access to a private preview
Hm, that's conflicting with the docs that I see here:
https://docs.stripe.com/payments/pay-by-bank#sign-up
Maybe we need to update them.
Either way, I'll work on getting feedback filed with the team, but based on what I'm seeing so far I wouldn't expect this to work as of now.
About preselection, what I need.
Preselect the country, update the country when element is already rendered.
Use case:
-
The user fills in the checkout form (name, phone, etc.) and selects a country.
-
Pay by Bank receives the country and renders the banks for the selected country.
-
The user decides to change the country on the checkout form.
-
The Pay by Bank widget receives the new country and displays the banks for the updated country.