#rockywearsahat
1 messages · Page 1 of 1 (latest)
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
Hi there, yes you can do so through https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-shipping_options
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
bet, so when using
stripe.checkout.sessions.create({
mode: 'payment',
//....etc....
//something like?
shipping_options: {
shipping_rate: 5,
},
});
and is it determined in cents?
No, it's expecting an ID of a shipping rate object https://stripe.com/docs/api/shipping_rates/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_KcmqMkVn5Rz2Ms is what I have for the most recent
Ok, the shipping_options is expecting an array of hashes. So you should write something like
shipping_options:[
{shipping_rate: 'shr_1O4cOeAI6vEkS2uiYRX40OgW'}
]
ohhhhhh lmao I'm really kinda stupid, so it just needs the id from that object?
Yes you are right