#DieserLoki
1 messages ยท Page 1 of 1 (latest)
Can you try changing that topmost layer to square brackets? It sounds like we are expecting an array but curly bracket notation makes it a hash
"shipping_rate_data": {
"display_name": "Standard Shipping",
"type": "fixed_amount",
"fixed_amount": {
"amount": "695",
"currency": "EUR"
}
}
],```
Oh, I send arrays, since I'm using php. all of those are arrays. This is just what I got from
https://dashboard.stripe.com/test/logs/req_Jelm1PJHUvBU6t?t=1676474025
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
In my Code it is actually
return [
'shipping_rate_data' => [
'display_name' => 'Standard Versand',
'type' => 'fixed_amount',
'fixed_amount' => [
'amount' => (int)round($product->getShipping()->getAmount() * 100),
'currency' => $product->getShipping()->getCurrency(),
]
]
]
Gotcha, checking in to the syntax here
Apologies I am still having trouble looking up this syntax. It does look like that is passing an array there
this is all i found:
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.
Hi there ๐ taking a look, please bear with me a moment.
I'm thinking this might be happening because that field is expect an array of hashes, but it's being provided a single hash (looks like that is an array in your code). If you double up the outer square brackets you're using, does that resolve the error?
Something like this:
'shipping_rate_data' => [
'display_name' => 'Standard Versand',
'type' => 'fixed_amount',
'fixed_amount' => [
'amount' => (int)round($product->getShipping()->getAmount() * 100),
'currency' => $product->getShipping()->getCurrency(),
]
]
]]```
๐คฆโโ๏ธ Thank you, that was actually it
Sweet, happy to help.