Skip to content

Add mollie_webhook_secret token to REST webhook endpoint#1242

Open
mmaymo wants to merge 6 commits into
dev/developfrom
PIWOO-910-webhook-authentication
Open

Add mollie_webhook_secret token to REST webhook endpoint#1242
mmaymo wants to merge 6 commits into
dev/developfrom
PIWOO-910-webhook-authentication

Conversation

@mmaymo

@mmaymo mmaymo commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@mmaymo mmaymo requested a review from danielhuesken June 30, 2026 09:27
$webhookUrl = untrailingslashit($webhookUrl);
} else {
$webhookUrl = add_query_arg(
['mollie_webhook_secret' => get_option('mollie_webhook_secret', '')],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When no webhook was received the option can be empty. Better is to use getOrCreateWebhookSecret method.

@mmaymo mmaymo requested a review from danielhuesken July 7, 2026 12:28

@danielhuesken danielhuesken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielhuesken danielhuesken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find the class WebhookSecret.

Comment thread src/Payment/Webhooks/RestApi.php Outdated
*/
public function registerRoutes()
{
$this->webhookSecret->getOrCreate();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what is it needed?

Comment thread src/Payment/Webhooks/RestApi.php Outdated
]);
}

public function getOrCreateWebhookSecret(): string

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method needed anymore?

Comment thread src/Payment/Webhooks/RestApi.php Outdated
return $this->webhookSecret->getOrCreate();
}

public function checkWebhookSecret(?string $incoming): bool

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method needed anymore?

Comment thread src/Payment/MollieOrderService.php Outdated
}

// Webhook test by Mollie
if (isset($_GET['testByMollie'])) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must the test also run against unauthenticated calls? Thant it must be before authentication check.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning to remove this check, is not documented and not used as far as I know

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I also found no documentation. I think it is an old leftover.

@mmaymo mmaymo requested a review from danielhuesken July 8, 2026 10:45

@danielhuesken danielhuesken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants