Skip to content
Snippets Groups Projects
Commit e1bb4368 authored by Uku Taht's avatar Uku Taht
Browse files

Show better error message when changing plans fails

parent ba6b897f
Branches
Tags schleuder-3.0.0.beta10
No related merge requests found
...@@ -47,9 +47,23 @@ defmodule PlausibleWeb.BillingController do ...@@ -47,9 +47,23 @@ defmodule PlausibleWeb.BillingController do
|> redirect(to: "/settings") |> redirect(to: "/settings")
{:error, e} -> {:error, e} ->
# https://developer.paddle.com/api-reference/intro/api-error-codes
msg =
case e do
%{"code" => 147} ->
"We were unable to charge your card. Make sure your payment details are up to date and try again."
%{"message" => msg} when not is_nil(msg) ->
msg
_ ->
"Something went wrong. Please try again or contact support at support@plausible.io"
end
Sentry.capture_message("Error changing plans", Sentry.capture_message("Error changing plans",
extra: %{ extra: %{
errors: inspect(e), errors: inspect(e),
message: msg,
new_plan_id: new_plan_id, new_plan_id: new_plan_id,
user_id: conn.assigns[:current_user].id user_id: conn.assigns[:current_user].id
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment