#Deathnfudge-hello
1 messages · Page 1 of 1 (latest)
Sorry about that. Hit enter too quickly.
I'm working on subscription reactivation after being canceled. I'm getting an error stating This customer has no attached payment source or default payment method.
Customers are created via Stripe Checkout. I'm fetching the customer but it's coming back without a default payment method. I'm seeing a card on file when looking at their account in the development dashboard. I'm not sure if we need to add a setting in order to set that card as their default payment method or if there's something I'm missing as I'm looking through the docs. This is what is linked to in the error message but I couldn't find anything that seemed to fix our issue.
https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority
Hmm. In the error it's giving me a nil for the request id.
Here's the full error. I'm using Elixir stripity_stripe.
{:error,
%Stripe.Error{
code: :invalid_request_error,
extra: %{
card_code: :resource_missing,
http_status: 400,
raw_error: %{
"code" => "resource_missing",
"doc_url" => "https://stripe.com/docs/error-codes/resource-missing",
"message" => "This customer has no attached payment source or default payment method. Please consider adding a default payment method. For more information, visit https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority.",
"type" => "invalid_request_error"
}
},
message: "This customer has no attached payment source or default payment method. Please consider adding a default payment method. For more information, visit https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority.",
request_id: nil,
source: :stripe,
user_message: nil
}}
Does that point to something being set up incorrectly?
Do you have any object ID I can look at?
I can likely find the error pretty easily. It should show in your Dashboard here: https://dashboard.stripe.com/test/logs
Perfect. Here's the request id.
req_CswcGYzlZ8Wu56
Customer id. cus_MIgUy3W0CbyJBB
Thanks! Taking a look
This is weird, or I'm missing something obvious 😅
Still looking
Ah wait I think I know
Okay yeah
So when you create a Subscription using Checkout it sets the PaymentMethod as the default for that Subscription
As opposed to setting it as the default at the Customer-level to be used for all Subscriptions for that Customer
So if you want to create a new Subscription and use the already-collected PaymentMethod, you either update the Customer to set that PaymentMethod as the default here: https://stripe.com/docs/api/customers/update?lang=curl#update_customer-invoice_settings-default_payment_method
Or, you pass the PaymentMethod as the default_payment_method for the Subscription upon Subscription creation: https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
Gotcha. Thanks for the help!