#xhudaman

1 messages · Page 1 of 1 (latest)

hollow kilnBOT
thorny palm
#

Let me know if that gets you oriented in the right direction.

#

As long as you pass usd when you create the Checkout Session, it will always be USD

sullen rune
#

Hey, thanks for the help! I have actually been following the guides and api docs and have had little success.
To clarify my setup, the price_data.currency is set to usd but the currency option on the top level of the checkout session options is not set

#

Here is a sanitized full snippet of my code to help:

const checkoutSession = await stripe.checkout.sessions.create({
  client_reference_id: sessionId,
  payment_method_types: ["card"],
  mode: "payment",
  line_items: [
    {
      price_data: {
        currency: 'usd',
        unit_amount: 0,
        product_data: {
          name: 'Bumper Sticker',
        }
      },
      quantity: 1,
      adjustable_quantity: {
        enabled: false
      },
    },
  ],
  shipping_address_collection: { allowed_countries: ['US', 'CA'] },
  shipping_options: [
    {
      shipping_rate_data: {
        display_name: "Mail",
        type: 'fixed_amount',
        fixed_amount: {
          amount: 80,
          currency: 'usd',
          currency_options: { cad: { amount: 300 }, }
        }
      }
    }
  ],
  success_url: `${baseUrl}/success?checkoutSuccess=true&success=true&sessionId=${sessionId}`,
  cancel_url: `${baseUrl}/success?checkoutCanceled=true&success=true&sessionId=${sessionId}`
});
thorny palm
#

The currency of the Price overrides the currency you set elsewhere, as far as I know. You can't take multiple currencies via a single payment unfortunately. You would need to create a separate transaction for shipping if you want to do that.

sullen rune
#

If I want to take a payment in USD and charge US customers $0.80 cents shipping and charge the equivalent of $1 CAD in USD, is there a way I can do that? Or would I have to custom code that?
As it stands I don't have geolocation available to guarantee I can access the user's location in my app

#

I guess my understanding of how the currency options interacted with things was a little off

thorny palm
#

But yeah, you can kind of choose which currency to present in, but you can't use a single charge and split it up into different currencies. Those have to be separate transactions

hollow kilnBOT
sullen rune
#

My goal is to have different shipping cost based on the country being shipped to, always charged in USD. I am happy with Stripe automatically converting the currency

indigo elk
#

👋 catching up since my teammate had to go! Give me a minute

indigo elk
#

Okay, sorry for the delay! If you need to charge a different shipping rate based on address, you'll need to collect the shipping address yourself (not using Checkout) and write your own code to calculate shipping cost

sullen rune
#

Ok, thanks a lot!