I'm stuck on this screen with laravel spark / paddle Webhooks work and I am successfully creating a subscription and paying for it in the sandbox, however I am unabel to see cancel / change plans views on my end.
Their support is super slow. They mentioned it's partially received data, however when I purchase the subscription paddle webhooks successfully send notifications into my local environment (to ngrok). Meaning my auth keys and everything else is correct.
my SparkServiceProvider.php is
<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\ValidationException;
use Spark\Plan;
use Spark\Spark;
class SparkServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Spark::billable(User::class)->resolve(function (Request $request) {
return $request->user();
});
Spark::billable(User::class)->authorize(function (User $billable, Request $request) {
return $request->user() &&
$request->user()->id == $billable->id;
});
Spark::billable(User::class)->checkPlanEligibility(function (User $billable, Plan $plan) {
// if ($billable->projects > 5 && $plan->name == 'Basic') {
// throw ValidationException::withMessages([
// 'plan' => 'You have too many projects for the selected plan.'
// ]);
// }
});
}
}
and User model:
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use LaraZeus\Bolt\Models\Concerns\BelongToBolt;
use Spark\Billable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use Billable, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
Thank you!