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]
#0 myProject/vendor/mollie/mollie-api-php/src/HttpAdapter/Guzzle6And7MollieHttpAdapter.php(175): Mollie\\Api\\Exceptions\\ApiException::createFromResponse()
#1 myProject/vendor/mollie/mollie-api-php/src/HttpAdapter/Guzzle6And7MollieHttpAdapter.php(104): Mollie\\Api\\HttpAdapter\\Guzzle6And7MollieHttpAdapter->parseResponseBody()
#2 myProject/vendor/mollie/mollie-api-php/src/MollieApiClient.php(538): Mollie\\Api\\HttpAdapter\\Guzzle6And7MollieHttpAdapter->send()
#3 myProject/vendor/mollie/mollie-api-php/src/MollieApiClient.php(494): Mollie\\Api\\MollieApiClient->performHttpCallToFullUrl()
#4 myProject/vendor/mollie/mollie-api-php/src/Endpoints/EndpointAbstract.php(101): Mollie\\Api\\MollieApiClient->performHttpCall()
#5 myProject/vendor/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php(72): Mollie\\Api\\Endpoints\\EndpointAbstract->rest_update()
#6 myProject/vendor/mollie/mollie-api-php/src/Resources/Payment.php(699): Mollie\\Api\\Endpoints\\PaymentEndpoint->update()
#7 myProject/vendor/mollie/laravel-cashier-mollie/src/Mollie/UpdateMolliePayment.php(13): Mollie\\Api\\Resources\\Payment->update()
#8 myProject/vendor/mollie/laravel-cashier-mollie/src/Http/Controllers/FirstPaymentWebhookController.php(31): Laravel\\Cashier\\Mollie\\UpdateMolliePayment->execute()
#9 myProject/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(48): Laravel\\Cashier\\Http\\Controllers\\FirstPaymentWebhookController->handleWebhook()
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