beam-community/stripity-stripe

Wrong type spec `create_params` in Stripe.Session

Victoria91 opened this issue · 0 comments

Hello and thanks for the library!
Recently you updated line_item type: some of the parameters are now wrapped in data, so my previous call of Stripe.Session.create started to fail on dialyzer. However, if I fix it to to match type spec, use params

%{line_items: [
        %{
          data: %{
            price: <price>,
            quantity: <quantity>
          }
        }
      ]}

instead of

%{line_items: [
        %{
            price: <price>,
            quantity: <quantity>
          }
      ]}

I will get error from Stripe:

%Stripe.Error{
  code: :invalid_request_error,
  extra: %{
    card_code: :parameter_unknown,
    http_status: 400,
    param: :"line_items[0][data]",
    raw_error: %{
      "code" => "parameter_unknown",
      "doc_url" => "https://stripe.com/docs/error-codes/parameter-unknown",
      "message" => "Received unknown parameter: line_items[0][data]",
      "param" => "line_items[0][data]",
      "type" => "invalid_request_error"
    }
  },
  message: "Received unknown parameter: line_items[0][data]",
  request_id: nil,
  source: :stripe,
  user_message: nil
}```