diff --git a/src/base/Gateway.php b/src/base/Gateway.php index 12df5105f6..0a5f95c908 100644 --- a/src/base/Gateway.php +++ b/src/base/Gateway.php @@ -62,7 +62,12 @@ public function getWebhookUrl(array $params = []): string $url = UrlHelper::actionUrl('commerce/webhooks/process-webhook', $params); - return StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', ''); + // Remove the cpTrigger from the url if it's there. + if (Craft::$app->getConfig()->getGeneral()->cpTrigger) { + $url = StringHelper::replace($url, Craft::$app->getConfig()->getGeneral()->cpTrigger . '/', ''); + } + + return $url; } /**