Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kensmithzzz's avatar

Cashier v10, Stripe SCA, and swapAndInvoice

Switching to the latest version of Cashier supporting Stripe's Strong Customer Authentication (SCA) has been a painful process.

I have new subscriptions working, but now I'm working on allowing users to switch plans.

Calling Subscription->swapAndInvoice(newPlan) does not allow me to prompt the user for any additional authentication their bank may require. Instead, the swap succeeds without it and Cashier then sends an email to the customer to complete the authentication after the fact (via a Stripe webhook I believe).

Has anyone fought this battle?

0 likes
2 replies
kensmithzzz's avatar

I've narrowed down the problem a little. The docs claim that swapAndInvoice should throw the IncompletePayment exception, but as far as I can tell it never does that.

swapAndInvoice eventually calls this code in vendor/laravel/cashier/src/Subscription.php

    public function invoice(array $options = [])
    {
        try {
            return $this->user->invoice(array_merge($options, ['subscription' => $this->stripe_id]));
        } catch (IncompletePayment $exception) {
            // Set the new Stripe subscription status immediately when payment fails...
            $this->fill([
                'stripe_status' => $exception->payment->invoice->subscription->status,
            ])->save();

            throw $exception;
        }
    }

This all looks like a good idea... But I don't see anywhere that the function $this->user->invoice() (defined in Billable.php) can throw an IncompletePayment exception.

Am I on the right track?

Please or to participate in this conversation.