#rockywearsahat

1 messages · Page 1 of 1 (latest)

median rainBOT
#

Hello rockywearsahat, we'll be with you shortly! 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.
rockywearsahat, 4 days ago, 19 messages
rockywearsahat, 5 days ago, 31 messages
rockywearsahat, 5 days ago, 36 messages
rockywearsahat, 5 days ago, 9 messages

young gyro
jagged eagle
#

bet, so when using

stripe.checkout.sessions.create({
mode: 'payment',
//....etc....
//something like?
shipping_options: {
shipping_rate: 5,
},
});
#

and is it determined in cents?

young gyro
jagged eagle
#

ah I see, so I have some code like this to create the shipping rate object:

const shippingRate = await stripe.shippingRates.create({
      display_name: "Standard Shipping",
      type: "fixed_amount",
      fixed_amount: {
        amount: 500,
        currency: "usd",
      },
    });

then when logging it I have a full json object, do I then json.stringify that or json.parse it and pass that array to shipping options?

#

this is the object that is logged after that snippet

#
{
  id: 'shr_1O4cOeAI6vEkS2uiYRX40OgW',
  object: 'shipping_rate',
  active: true,
  created: 1698122356,
  delivery_estimate: null,
  display_name: 'Standard Shipping',
  fixed_amount: { amount: 500, currency: 'usd' },
  livemode: false,
  metadata: {},
  tax_behavior: 'unspecified',
  tax_code: null,
  type: 'fixed_amount'
}
#

however I'm still getting an invalid array when pasing that shipping rate object to the stripe.checkout.sessions.create call in shipping_options: shippingRate

young gyro
jagged eagle
#

req_KcmqMkVn5Rz2Ms is what I have for the most recent

young gyro
#

Ok, the shipping_options is expecting an array of hashes. So you should write something like

shipping_options:[
  {shipping_rate: 'shr_1O4cOeAI6vEkS2uiYRX40OgW'}
]
jagged eagle
#

ohhhhhh lmao I'm really kinda stupid, so it just needs the id from that object?

young gyro
#

Yes you are right

jagged eagle
#

yep it works perfect , I really appreciate it hella

#

thank you!