<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
roundly-consulting / purchases-for-laravel example snippets
use RoundlyConsulting\Purchases\Facades\Purchases;
$model = Purchases::handle('stripe', $request); // verify the signature, record, fire events
use App\Models\User;
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Purchases\Events\SubscriptionStarted;
Event::listen(function (SubscriptionStarted $event): void {
$customer = $event->result->raw()['customer']; // the Stripe customer id
$event->subscription->owner()->associate(User::firstWhere('stripe_id', $customer));
$event->subscription->name = 'pro'; // Stripe names no plan
$event->subscription->save();
});