Hello,
My custom aftercare_webhook_url
config is ignored.
I'm using custom webhooks locally.
My config/cashier.php
is as follows :
return [
'webhook_url' => 'https://ff70-89-156-98-187.ngrok.io/webhooks/mollie',
'aftercare_webhook_url' => 'https://ff70-89-156-98-187.ngrok.io/webhooks/mollie/aftercare',
'first_payment' => [
'webhook_url' => 'https://ff70-89-156-98-187.ngrok.io/webhooks/mollie/first-payment',
I'm generating a checkoutUrl
like this :
$authUser->newSubscription('main', 'my_plan')->create();
return $response->payment()->getCheckoutUrl();
After paying; the webhook POST /webhooks/mollie/first-payment
is called but returns an error 500 :
Error executing API call (422: Unprocessable Entity): The webhook URL is invalid because it is unreachable from Mollie's point of view.. Field: webhookUrl. Documentation: https://docs.mollie.com/reference/v2/payments-api/update-payment {"exception":"[object] (Mollie\\Api\\Exceptions\\ApiException(code: 422): [2022-10-28T19:12:24+0000] Error executing API call (422: Unprocessable Entity): The webhook URL is invalid because it is unreachable from Mollie's point of view.. Field: webhookUrl. Documentation: https://docs.mollie.com/reference/v2/payments-api/update-payment at myProject/vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php:114)
[stacktrace]
It seems that the webhook url used here is incorrect (it ignores my custom domain):
https://github.com/mollie/laravel-cashier-mollie/blob/8c1d5babc3c3e0339da91532983fe0790811ba11/src/Http/Controllers/FirstPaymentWebhookController.php#L28
In my case something like this would make more sense :
- $payment->webhookUrl = route('webhooks.mollie.aftercare');
+ $payment->webhookUrl = config('cashier.aftercare_webhook_url');
If you confirm that this is not the expected behaviour I can work on a pull request, with some of your guidance.
Thanks