basagabi
basagabi

Reputation: 5064

Laravel Paddle Billing not saving to database

I'm using Laravel Cashier for Paddle integration on the backend while using NextJS for the Paddle integration on the frontend via Paddle's checkout overlay feature. I am able to connect the checkout to my backend API using webhooks via ngrok on my local.

Base on the logs from ngrok and paddle, there's no error. However, no data is being saved on the database. I am expecting data to be saved on the following tables:

On the Paddle's sandbox dashboard, I can see that the customer has been created and transactions has pushed thru since I can see the amount and product purchased by the customer.

I followed the documentation on integrating Paddle via Laravel Cashier provided on Laravel's documentation. These are what I've done so far:

Added .env variables:

PADDLE_CLIENT_SIDE_TOKEN=<add client side key here, not necessary as I am using NextJS for the frontend>
PADDLE_API_KEY=<add API key here>
PADDLE_SANDBOX=true
PADDLE_WEBHOOK_SECRET=<add secret key here>

Added Laravel\Paddle\Billable on the User model.

Below are the screenshots from the app and logs:

Successful transaction using the overlay checkout:

enter image description here

Ngrok logs showing 200 OK on all events:

enter image description here

Paddle's webhook notification log on their dashboard:

enter image description here

Should Cashier handle these already when the webhook is triggered?

Upvotes: -2

Views: 147

Answers (1)

kz.dev
kz.dev

Reputation: 1

I encountered an issue where the WebhookController wasn't called for Paddle webhooks due to a conflicting route in web.php. I had defined a direct route that blocked the controller from being invoked. By removing the conflicting route, I ensured that webhook requests were properly routed to the WebhookController.

Don't do this :

Route::post('/paddle/webhook', function (Request $request) {
    Log::info('Paddle Webhook Received:', $request->all());
});

Upvotes: -1

Related Questions