1

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:

enter image description here

enter image description here

  • Your problem is definitely with your webhook setup. Can you please show your webhook setup? Can you share your event handlers if possible? – oralunal Feb 27 '23 at 22:58
  • @oralunal, I have added the screenshots of the Paddle dashboard. I have not setup any event listener myself. I am assuming that the cashier will handle it by himself. If you want me to go into the cashier package and share the listner code from there then let me know. – Arqam Saleem Feb 28 '23 at 13:31
  • You should set event listener, btw, paddle will update your database with webhooks.. You have to catch the request with event listeners and process them. – oralunal Mar 01 '23 at 00:11

0 Answers0