From 3e39b11749056c767eef3799c12e1064f06f4653 Mon Sep 17 00:00:00 2001 From: Andreas Tasch Date: Thu, 18 Aug 2022 00:08:29 +0200 Subject: [PATCH] Add undocumented param secret to workaround BTCPay Server bug. (#69) * Add $secret param on updateWebhook() which is needed to work around a bug in BTCPay Server versions <= 1.6.3.0. --- src/Client/Webhook.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Client/Webhook.php b/src/Client/Webhook.php index 9aeaebd..edeeced 100644 --- a/src/Client/Webhook.php +++ b/src/Client/Webhook.php @@ -164,18 +164,33 @@ public function createWebhook( } } + /** + * Updates an existing webhook. + * + * Important: due to a bug in BTCPay Server versions <= 1.6.3.0 you need + * to pass the $secret explicitly as it would overwrite your existing secret + * otherwise. On newer versions BTCPay Server >= 1.6.4.0, if you do NOT set + * a secret it won't change it and everything will continue to work. + * + * @see https://github.com/btcpayserver/btcpayserver/issues/4010 + * + * @return \BTCPayServer\Result\Webhook + * @throws \JsonException + */ public function updateWebhook( string $storeId, string $url, string $webhookId, ?array $specificEvents, bool $enabled = true, - bool $automaticRedelivery = true + bool $automaticRedelivery = true, + ?string $secret = null ): \BTCPayServer\Result\Webhook { $data = [ 'enabled' => $enabled, 'automaticRedelivery' => $automaticRedelivery, - 'url' => $url + 'url' => $url, + 'secret' => $secret ]; // Specific events or all.