#yagnesh-p_best-practices

1 messages ยท Page 1 of 1 (latest)

timber stagBOT
#

๐Ÿ‘‹ 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/1460482057133232262

๐Ÿ“ 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.

#

โ›”๏ธ Stripe developers have stepped away for a short while

Please leave your questions here, and weโ€™ll respond as soon as we're back! If you need help urgently, you can contact Stripe support for help.

timber stagBOT
wanton jewel
#

hi there ๐Ÿ‘‹ , thank you for waiting. give me some time to catch up on the question

#

It looks like you're asking about Adaptive Pricing. If I understand correctly, you're looking to find out what's the currency selected by the customer.

There are two ways to know the currency user paid in from the PaymentIntent created from the checkout session:
1/ First its through the Dashboard โ€” if you look up the PaymentIntent in the Dashboard, under Payment breakdown, we will indicate what currency customer paid in

2/ The other approach is using the checkout_session.completed event โ€” the event body would show presentment details that includes the currency your customer paid in. It looks like

presentment_details: {
      presentment_amount: 1099, // the amount paid in customer's local currency
      presentment_currency: "cad", // currency customer paid in
    },
prisma prism
#

Okay,
Here's what I have done:

  this.elements = await this.stripeV3.initCheckout({
                fetchClientSecret: () => this.getClientSecret(clientSecret),
                elementsOptions: { appearance: this.isDarkMode() ? STRIPE_APPEARANCE_ELEMENT_DARK_TW : STRIPE_APPEARANCE_ELEMENT_LIGHT_TW },
            });
                this.elements.on('change', (event: any) => {
                    console.log('checkout Stripe Event ====:', event);
                    console.log('checkout stripe currency ======', event.currency)
                    console.log('checkout stripe total total amount ======', event.total.total.amount)
                   
#

this is giving me amount and currency i wanted.
what i wanted was i want to know which currency is selected by customer in on going checkout session, so that i can disaply it in the button

#

not after checkout session completed

wanton jewel
#

What is the ui_mode for your checkout session? Do you have a checkout session ID we can use as an example

prisma prism
#

It is custom

#

cs_test_a1VnUFc2I4OLYwQadPX6ymdZHPwmGPPGAXxhirHNTIm2ToOWCm6DaZ0ezd

wanton jewel
prisma prism
#

Okay this is wokring too. thanks

#

Also is there any way that i can disable the stripe input field of the billing and shipping elements

wanton jewel
#

Do you mean you don't want to collect billing/shipping details? The collection of these information depends on how your checkout session is created in the backend.

It is not possible to turn off billing details collection completely. [0]
For shipping details, this is only collected if you set shipping_address_collection [1]

[0] https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-billing_address_collection
[1] https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-shipping_address_collection

prisma prism
#

I want to collect the information and I am collecting it too but in my business logic, after receiving the complete event for the billing and shipping I want to disable that fields.

wanton jewel