Unable to process charges for customers with default credit card having payment ID in the form of pm_xxx, since upgrading to Laravel 8
We are unable to process charges for customers who have a default credit card on their account, where the ID of the customer's default payment method is in the form pm_XXX. For example: pm_1Jig9sFuiQHBUm2...
When I use Cashier to get the customer's default payment method, line 132 of ManagesPaymentMethods.php performs the following call:
$customer = $this->asStripeCustomer(['invoice_settings.default_payment_method']);
And invoice_settings.default_payment_method is null, for any customer whose default credit card is stored in Stripe, by Cashier, with the ID of the payment method in the format pm_xxx.
We are able to process charges for customers where the customer's default credit card was created by Cashier and has an ID in the format of card_XXX. For example: card_1Dq2XIFuiQHBU...
I've spent a couple of hours on phone and chat with Stripe, with no resolution. Below is the last email that they sent me, which seems to simply say that the Cashier package changed the way that customers are created, and the Cashier package is checking for the customer default payment methods, and that we need to stop checking for the default payment method before processing the charge, but I am unable to find any thing in Cashier documentation that explains how to do that. Cashier seems to only process charges after calling Stripe for the default payment method.
Below is the last email that I received from Stripe support. Does anyone know how I can resolve this issue and process charges for customers with default credit cards that have payment ID in the format of pm_xxx?
Thanks!
******* BEGIN EMAIL FROM STRIPE **********
As discussed you may omit the payment method when creating the Payment Intent.
You've mentioned that this issue only started on September, so I've gone ahead and reviewed the transactions you had. I can see that you've created the payment intent with payment method but there were no request to retrieve the customer. Unlike the process that you're doing now that you have to retrieve the customer and get the invoice_settings.default_payment_method to get the payment method of a customer.
Here are the two different payment intent you've sent to us before:
https://dashboard.stripe.com/logs/req_Oj46WeRIs31kOr https://dashboard.stripe.com/logs/req_KWnm1rENxYT7xq
If you notice on this logs, there's no request to get the customer payment method, but right away, you were able to include the payment method when creating the payment intent.
https://dashboard.stripe.com/logs?created%5Bgte%5D=1628485200&created%5Blte%5D=1628571599
Comparing it to your current process right now where you're retrieving the customer and expanding invoice_settings.default_payment_method before creating the payment intent.
I'm not sure if this additional step you're doing right now is due to upgrade you have with Laravel, but it's worth checking with them and see if you can have the same workflow you had before. Although redirecting who contacts us is never ideal, as we strive to take complete ownership of your question, I want to ensure you are on the right track and getting the assistance you deserve.
I hope this gets you on the right track, but if there's anything else we can do to help, don't hesitate to reach back out.
Please or to participate in this conversation.