Skip to content

Commit

Permalink
Add undocumented param secret to workaround BTCPay Server bug. (#69)
Browse files Browse the repository at this point in the history
* Add $secret param on updateWebhook() which is needed to work around a bug in BTCPay Server versions <= 1.6.3.0.
  • Loading branch information
ndeet authored Aug 17, 2022
1 parent 155c182 commit 3e39b11
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Client/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3e39b11

Please sign in to comment.