I'm following the guidelines on the Laravel Documentation to configure the cashier-paddle package. But after successful payment using a sandbox account, it's not saving the entry in the local database, but the entry in the Paddle dashboard is present under customers.
web.php
Route::get('/user/subscribe', function (Request $request) {
$payLink = User::find(1)->newSubscription('default', $premium = 45680)
->returnTo('https://arqam-saleem.sharedwithexpose.com/')
->create();
//print_r($payLink);
return view('billing', ['paylink' => $payLink]);
})->name('user.subscribe');
Here is the Model
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 Laravel\Paddle\Billable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use Billable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
billing.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
@paddleJS
</head>
<body>
<x-paddle-button :url="$paylink" class="px-8 py-4">
Buy
</x-paddle-button>
</body>
</html>
I am using Expose to create a public URL to add to the Paddle dashboard for receiving webhooks. But it's still not working. Any idea why it's happening? I can share more details if needed.
In Paddle's notification logs, all are marked as failed or retrying which will ultimately be failed.
Note: It's a local environment on Windows.
Webhook settings screenshots from Paddle Dashboard: