From 358c5aa113c1ed3b4385859af172fb7f4e35d25e Mon Sep 17 00:00:00 2001 From: Artur <33733651+Keeqler@users.noreply.github.com> Date: Thu, 22 May 2025 15:49:58 -0300 Subject: [PATCH] fix(btcpay webhook): use new paymentMethodId value when getting crypto code --- pages/api/btcpay/webhook.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/api/btcpay/webhook.ts b/pages/api/btcpay/webhook.ts index 20ab085..f40e1ab 100644 --- a/pages/api/btcpay/webhook.ts +++ b/pages/api/btcpay/webhook.ts @@ -39,7 +39,7 @@ type WebhookBody = Record & { storeId: string invoiceId: string metadata?: DonationMetadata - paymentMethod: string + paymentMethodId: string } async function handleFundingRequiredApiDonation(body: WebhookBody) { @@ -58,9 +58,9 @@ async function handleFundingRequiredApiDonation(body: WebhookBody) { } // Handle payment methods like "BTC-LightningNetwork" if added in the future - const cryptoCode = body.paymentMethod.includes('-') - ? body.paymentMethod.split('-')[0] - : body.paymentMethod + const cryptoCode = body.paymentMethodId.includes('-') + ? body.paymentMethodId.split('-')[0] + : body.paymentMethodId const { data: rates } = await btcpayApi.get( `/rates?currencyPair=${cryptoCode}_USD`