#okawei

1 messages · Page 1 of 1 (latest)

slate gateBOT
reef meadow
#

👋 happy to help

#

sorry for the late reply

opal totem
#

No worries!

reef meadow
#

would you mind moving all your messages to the channel and removing them from the main channel please

opal totem
#

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"
  }
}
reef meadow
#

let me take a look

#

give me a minute or two please

opal totem
#

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"
    }
}
reef meadow
#

sorry for my late reply

opal totem
#

No worries!

#

I've tried upgrading my stripe API version to the latest and the error still happens 😦

reef meadow
opal totem
#

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!

reef meadow
#

yes I agree I will pass the feedback to the internal team

opal totem
#

Thank you!

#

⭐ ⭐ ⭐ ⭐ ⭐

reef meadow
#

sorry again for the late reply

#

let me know if you need any more help

opal totem
#

Will do

#

FYI the example in the docs is missing this param as well

reef meadow
#

would you mind sharing the link?

opal totem
#

At least for the cURL and go examples

#

Actually, just checked the other languages, looks like it's missing there too

reef meadow
#

yeah you're right it is in the table but not in the code

opal totem
#

Yep

reef meadow
#

I'll pass the feedback