Connect Paddle to Project

To get started with Paddle, install Laravel Cashier Paddle package by running following command

composer require laravel/cashier-paddle

During local and staging development, you should register a Paddle Sandbox account. This account will give you a sandboxed environment to test and develop your applications without making actual payments. You may use Paddle’s test card numbers to simulate various payment scenarios.

When using the Paddle Sandbox environment, you should set the PADDLE_SANDBOX environment variable to true within your application’s .env file:

.env
PADDLE_SANDBOX=true

After you have finished developing your application you may apply for a Paddle vendor account. Before your application is placed into production, Paddle will need to approve your application’s domain.

Set API Keys

To create Client Side Token and API Key go to -> https://sandbox-vendors.paddle.com/authentication-v2

.env
PADDLE_CLIENT_SIDE_TOKEN=test_a9327e5cb0d4414c94f4011d065
PADDLE_API_KEY=3d6bd06df7a5715ca10a0caf8ef29d6802d11605cdf8ec82b0
PADDLE_RETAIN_KEY=your-paddle-retain-key
PADDLE_WEBHOOK_SECRET="your-paddle-webhook-secret"
PADDLE_SANDBOX=true

Migrations

Next, you should publish the Cashier migration files using the vendor:publish Artisan command:

php artisan vendor:publish --tag="cashier-migrations"

Then, you should run your application’s database migrations. The Cashier migrations will create a new customers table. In addition, new subscriptions and subscription_items tables will be created to store all of your customer’s subscriptions. Lastly, a new transactions table will be created to store all of the Paddle transactions associated with your customers:

php artisan migrate

For more details on initial setup and webhooks see official Laravel doc for Paddle -> https://laravel.com/docs/11.x/cashier-paddle#introduction

Components

Paddle Payment is handled inside app/Http/Controllers/Payments/PaddleController.php file

Vue component located in `resources/js/Components/Paddle/PaddlePlans.vue