I just wanted to reply back to the resolution of this. This SubscriptionUpdated or SubscriptionCancelled events are triggered by call backs from Stripe. I was under the impression they were executed when the user makes the change on the UI. That only happens on the SubscriptionCreated event.
Oct 2, 2022
1
Level 1
Laravel Spark (Next) - Using Event SubscriptionUpdated
Having trouble using the SubscriptionUpdated event with Laravel Spark-Stripe.
I am successful in hooking SubscriptionCreated to perform some actions, it just doesn't seem to work with Update.
The test process is changing the subscription plan between two different plans.
Here is essentially the code I'm using.
namespace App\Listeners;
use Spark\Events\SubscriptionCreated;
use Spark\Events\SubscriptionUpdated;
use Spark\Events\SubscriptionCancelled;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class SparkSubscriptionUpdate
{
public function handle($event)
{
//do something;
}
public function subscribe($events)
{
return [
SubscriptionCreated::class => 'handle',
SubscriptionUpdated::class => 'handle',
SubscriptionCancelled::class => 'handle',
];
}
}
use App\Listeners\SparkSubscriptionUpdate;
class EventServiceProvider extends ServiceProvider
{
protected $subscribe = [
SparkSubscriptionUpdate::class,
];
}
Please or to participate in this conversation.