Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [shift4][bitpay] mark webhook source verification as false (#14647)

Akshaya Shankarce8c065406cd
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
index 6859a254a5..6f70fe53bc 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
@@ -383,6 +383,21 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Bitpay {
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Bitpay {
+ async fn verify_webhook_source(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
+ _connector_account_details: common_utils::crypto::Encryptable<
+ hyperswitch_masking::Secret<serde_json::Value>,
+ >,
+ _connector_name: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ // Bitpay does not provide a signature in the webhook request, so we cannot verify the source of the webhook.
+ // On returning false we will trigger a Psync call to the connector to get the latest status of the payment.
+ Ok(false)
+ }
+
fn get_webhook_object_reference_id(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs
index 388f336a98..aa0be07ece 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs
@@ -822,6 +822,20 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Shift4 {
#[async_trait::async_trait]
impl IncomingWebhook for Shift4 {
+ async fn verify_webhook_source(
+ &self,
+ _request: &IncomingWebhookRequestDetails<'_>,
+ _merchant_id: &common_utils::id_type::MerchantId,
+ _connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
+ _connector_account_details: common_utils::crypto::Encryptable<
+ hyperswitch_masking::Secret<serde_json::Value>,
+ >,
+ _connector_name: &str,
+ ) -> CustomResult<bool, errors::ConnectorError> {
+ // Shift4 does not cryptographically sign incoming webhook notifications, so we cannot verify the source of the webhook.
+ // On returning false we will trigger a Psync call to the connector to get the latest status of the payment.
+ Ok(false)
+ }
fn get_webhook_object_reference_id(
&self,
request: &IncomingWebhookRequestDetails<'_>,