#okawei
1 messages · Page 1 of 1 (latest)
No worries!
would you mind moving all your messages to the channel and removing them from the main channel please
Messages are deleted
I think there's a bug in stripes API docs for how to add shipping methods to checkout sessions
Even the default example returns an error
curl https://api.stripe.com/v1/checkout/sessions \
-u redacted: \
-d "payment_method_types[0]"=card \
-d "shipping_address_collection[allowed_countries][0]"=US \
-d "shipping_address_collection[allowed_countries][1]"=CA \
-d "shipping_options[0][shipping_rate_data][fixed_amount][amount]"=0 \
-d "shipping_options[0][shipping_rate_data][fixed_amount][currency]"=usd \
-d "shipping_options[0][shipping_rate_data][display_name]"="Free shipping" \
-d "shipping_options[0][shipping_rate_data][delivery_estimate][minimum][unit]"=business_day \
-d "shipping_options[0][shipping_rate_data][delivery_estimate][minimum][value]"=5 \
-d "shipping_options[0][shipping_rate_data][delivery_estimate][maximum][unit]"=business_day \
-d "shipping_options[0][shipping_rate_data][delivery_estimate][maximum][value]"=7 \
-d "line_items[0][price_data][currency]"=usd \
-d "line_items[0][price_data][product_data][name]"=T-shirt \
-d "line_items[0][price_data][unit_amount]"=2000 \
-d "line_items[0][quantity]"=1 \
-d mode=payment \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel"
{
"error": {
"code": "parameter_missing",
"doc_url": "https://stripe.com/docs/error-codes/parameter-missing",
"message": "Missing required param: type.",
"param": "type",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_EJlwGhWEXjx8VV?t=1669380172",
"type": "invalid_request_error"
}
}
Here's the docs https://stripe.com/docs/payments/checkout/shipping#create-checkout-session-with-options
Sure thing
If I add a param type at the top level of the request object I get this error
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameter: type",
"param": "type",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_oiigdDm5i2UZDz?t=1669380585",
"type": "invalid_request_error"
}
}
sorry for my late reply
No worries!
I've tried upgrading my stripe API version to the latest and the error still happens 😦
you're missing the type parameter https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-shipping_options-shipping_rate_data-type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That was it!
Weird that the error console was saying the type param should be at the top level of the object
Thanks for the help!
yes I agree I will pass the feedback to the internal team
would you mind sharing the link?
At least for the cURL and go examples
Actually, just checked the other languages, looks like it's missing there too
yeah you're right it is in the table but not in the code
Yep
I'll pass the feedback