#yetissile_best-practices

1 messages · Page 1 of 1 (latest)

next echoBOT
#

👋 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/1285203837355036673

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

unique pagoda
#

Hi, let me help you with this.

waxen valley
#

Hi Vanya, thanks for your reply

#

So it is not required to make the payment work? Is it just for collecting information?

unique pagoda
next echoBOT
waxen valley
#

All right, it's complementary.

Well, I'll leave the two, then:

// Récupérer le pays du formulaire WooCommerce
var country = jQuery('select[name="billing_country"]').val() || '';
country = country.trim();
if (country === '') country = 'FR';

// Créer le Payment Element avec l'apparence personnalisée
paymentElement = elements.create('payment', {
defaultValues: {
billingDetails: {
address: {
country: country
}
}
},
fields: {
billingDetails: {
address: {
country: 'never'
}
}
}
});

daring oasis
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

next echoBOT
bitter root
#

Hi there 👋 jumping in as my teammate needed to step away. Since you're hiding the field from being shown in the Payment Element, you may encounter an error during confirmation if you don't also provide the country value during that confirmation. If that happens, you'll want to include the country you collect from your field when confirming the payment in confirmParams.payment_method_data.billing_details
https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details