This is the code:
<?php
namespace App\Http\Controllers;
use Inertia\Inertia;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class BillingController extends Controller
{
public function index(Request $request) {
return Auth::user()
->newSubscription('default', 'price_#################')
->checkout();
}
}
It correctly redirects me on stripe's checkout page, it correctly handles the payment and redirects me back on my website. I can actually see the active subscriptions in stripe's panel but I have no active subscription on my website's account.
>>> User::first()->subscriptions;
=> Illuminate\Database\Eloquent\Collection {#4476
all: [],
}
>>> User::first()->subscribed('default');
=> false
There's a point in the Laravel docs which says it automatically handles the subscription association (through a magic internal method I guess) but it's not working out.
Stripe's CLI caught these events at my payment action:
2021-10-19 23:34:16 --> charge.succeeded [evt_############]
2021-10-19 23:34:16 --> checkout.session.completed [evt_############]
2021-10-19 23:34:16 --> invoice.created [evt_############]
2021-10-19 23:34:16 --> invoice.finalized [evt_############]
2021-10-19 23:34:16 --> customer.subscription.created [evt_############]
2021-10-19 23:34:17 --> invoice.updated [evt_############]
2021-10-19 23:34:17 --> customer.subscription.updated [evt_############]
2021-10-19 23:34:17 --> invoice.paid [evt_############]
2021-10-19 23:34:17 --> invoice.payment_succeeded [evt_############]
2021-10-19 23:34:17 --> payment_intent.succeeded [evt_############]
2021-10-19 23:34:17 --> payment_intent.created [evt_############]
What am I missing? Should I manually listen for customer.subscription.created and use my own logic?