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

lyndon's avatar

Laravel Cashier Checkout() creating subscription in stripe but not in DB.

I am following the steps in laravel docs to create a stripe subscription using the following example:

Route::get('/subscription-checkout', function (Request $request) {
    return $request->user()
        ->newSubscription('default', 'price_basic_monthly')
        ->trialDays(5)
        ->allowPromotionCodes()
        ->checkout([
            'success_url' => route('your-success-route'),
            'cancel_url' => route('your-cancel-route'),
        ]);
});

I have webhooks correctly set up and everything seems to work fine but no subscription records are created in the database. Using Laravel Telescope, I can see a 200 response on all the /stripe/webhook post requests: https://ibb.co/8mHDC5Q.

It may be worth noting also that I'm using another model apart from User as the billable model and that has also been correctly set up in the AppServiceProvider class like so:

use App\Models\Tenant;

public function boot()
{
	Cashier::useCustomerModel(Tenant::class);
}

I've been at this for almost a week now and I'm not exactly sure what I'm doing wrong here. Any help will be greatly appreciated.

0 likes
5 replies
hupp's avatar

@lyndon Route::post('/stripe/webhook', 'WebhookController@handleWebhook');

use Illuminate\Support\Facades\Log;
class WebhookController extends Controller
{
    public function handleWebhook(Request $request)
    {
        Log::info('Webhook received:', $request->all());

        // Your webhook handling logic here

        return response()->json(['success' => true]);
    }
}

Here check what you get and how you have handle it to store in db. if you still not get any issue. Post here more detail to debug it. let me know your feedback.

lyndon's avatar

@hupp do you mean I have to create my own webhook controller? I thought this was already handled by Cashier.

lyndon's avatar

@hupp I'm already following the steps outlined in the docs.

lyndon's avatar
lyndon
OP
Best Answer
Level 2

I found the culprit... I am using the Stancl multitenancy package and it doesn't recognize custom fields (the additional stripe fields added by cashier migrations) on the tenants table by default so I had to do this in the Tenant model:

public static function getCustomColumns(): array
	{
		return [
			'stripe_id',
			'pm_type',
			'pm_last_four',
			'trial_ends_at',
		];
	}

Everything works fine now.

1 like

Please or to participate in this conversation.