#yoshinori hisakawa
1 messages · Page 1 of 1 (latest)
hello! you wouldn't specify JP when creating the PaymentIntent. You can specify it when confirming the PaymentIntent : https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details
On the front end, when I specify confirmPayment, should I also specify billing_details?
yep, that's right
const { error } = await stripe.confirmPayment({
elements,
redirect: 'if_required',
confirmParams: {
payment_method_data: {
billing_details: {
address: {
country: 'never',
},
},
},
},
});
On the front end, I have specified the following, but the country information is not hidden and I need your support!
you would specify Japan in your code above
address: {
country: 'JP',
},
},```
if you want to omit the country selection in the Payment Element, you can specify never in this field : https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails when creating the Payment Element
I'd like to skip this!
In that case, how do I pass const hoge to confirmPayment?
const hoge = elements.create('payment', {
fields: { billingDetails: { address: { country: 'never' } } },
});
const { error } = await stripe.confirmPayment({
elements,
redirect: 'if_required',
// where?
});
i believe my colleague already provided example code yesterday : #1077046309728550994 message
Perhaps you'd want to try that out?
I had overlooked it.
I checked and wrote it down, but how should I handle paymentElement after this?
const paymentElement = elements.create('payment', {
fields: {
billingDetails: {
address: {
country: 'never',
},
},
},
});
const { error } = await stripe.confirmPayment({
elements,
redirect: 'if_required',
// where?
});
if you want an example of how to accept payments using the Payment Element, i'd suggest looking at https://stripe.com/docs/payments/quickstart