Search code examples
phplaravellaravel-8webhookslaravel-cashier

Laravel Cashier Paddle - unable to resolve the specified webhook URL


I am trying to set up Laravel Cashier with Paddle (docs) but for some reason subscriptions are not being created in my database. I generate a pay link on the server and render it in the view, it sends me through the Paddle payment flow but after completing that no subscription is created.

I think Cashier is supposed to create the subscription after receiving the subscription_created webhook event, but I can't seem to connect Paddle and my application. Using the Paddle Webhook Simulator I get an error that Paddle "was unable to resolve the specified webhook URL".

paddle sandbox unable to resolve the specified webhook URL

I have my sandbox credentials stored in my .env variables:

PADDLE_VENDOR_ID=1234
PADDLE_VENDOR_AUTH_CODE=XXXXX
PADDLE_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
XXXXXXXXXX
-----END PUBLIC KEY-----"
PADDLE_SANDBOX=true

Then generate the pay link for the user to click on:

'monthlyPlanLink' => auth()->user()->newSubscription('monthly', $monthlyPlanId)
                ->returnTo(route('candidate.dashboard'))
                ->create()

I'm able to click through the Paddle UI and enter test card numbers, but after clicking pay no subscription is created. I defined the route explicitly in my routes/web.php folder and have updated paddle/* to be excluded from CSRF protection. This is the paddle webhook route:

Route::post('/paddle/webhook', 'WebhookController')->name('webhook');

I'm unable to receive the webhook from Paddle and create a subscription row for a user. What am I doing wrong here and how can I create subscriptions for my users once they've entered their payment information?

I have "laravel/cashier-paddle": "^1.4" installed in composer.json.


Solution

  • I sent a PR and updated the docs. For local development you need to use something like Ngrok or Expose to make your local development endpoints accessible to Paddle (and the rest of the world). Without that .test domains are only accessible on your own computer.

    https://laravel.com/docs/8.x/cashier-paddle#webhooks-local-development