POST route/webhook not triggering

I’m building a shop using Merx and I’m building a custom payment gateway for Mollie.

Mollie calls a webhook on my server using POST. To test if it’s called, I’m simply updating a page title, but it does not seem to work. If I remove the post method and call the webhook manually (by visiting the route) the page title does get updated.

However, Mollie’s admin panel is telling me it successfully called the webhook.

'routes' => [
[
	'pattern' => 'webhook',
	'method' => 'post',
	'action' => function () {
		try {	
			page('catering')->update([
			'title' => 'mollie-called-webhook',
			]);
		} catch(Exception $e) {
			echo $e->getMessage();
		}
	} 
],

The problem here is not the webhook, but you need to authenticate to be able to call the $page->update() method => kirby()->impersonate(‘kirby’)

1 Like

Well that was an easy enough solution. It’s working, thank you.