Skip to content

Conversation

@swetasharma03
Copy link
Contributor

@swetasharma03 swetasharma03 commented Feb 2, 2026

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

1. Add webhook endpoint
curl --location 'http://localhost:8080/account/merchant_1770066678/business_profile/pro_Bgptl6v324V9Mkg5EZFg/webhooks' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_pg81ddvK4zXUqdoHjGr991KKIuFLINb2I95jce4YYwbpHX5YO2WIR9mjsTiwT7Om' \
--data '{
    "webhook_url": "https://example.com/webhook2",
    "events": [
        "payment_succeeded",
        "refund_succeeded",
        "refund_failed"
    ],
    "status": "active"
}
'

Response:

{
    "merchant_id": "merchant_1770066678",
    "profile_id": "pro_Bgptl6v324V9Mkg5EZFg",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "4oJzmWIss8F1SBf93O8wPiM3V2OOpVtbM0IDYylbLPZyQh823dAyLGNJ4ccEZw3V",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": null,
        "webhook_username": null,
        "webhook_password": null,
        "webhook_url": null,
        "payment_created_enabled": null,
        "payment_succeeded_enabled": null,
        "payment_failed_enabled": null,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null,
        "multiple_webhooks_list": [
            {
                "webhook_endpoint_id": "whe_UMn40KCSWVWcVT30C5MY",
                "webhook_url": "https://example.com/webhook2",
                "events": [
                    "refund_failed",
                    "refund_succeeded",
                    "payment_succeeded"
                ],
                "status": "active"
            }
        ]
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
2. Update webhook endpoint
curl --location --request PUT 'http://localhost:8080/account/merchant_1770066678/business_profile/pro_Bgptl6v324V9Mkg5EZFg/webhooks/whe_UMn40KCSWVWcVT30C5MY' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_pg81ddvK4zXUqdoHjGr991KKIuFLINb2I95jce4YYwbpHX5YO2WIR9mjsTiwT7Om' \
--data '
{
    "events": [
        "payment_succeeded",
        "refund_failed",
        "refund_succeeded",
        "dispute_expired",
        "mandate_revoked"
    ],
    "status": "inactive"
}'

Response:

{
    "merchant_id": "merchant_1770066678",
    "profile_id": "pro_Bgptl6v324V9Mkg5EZFg",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "4oJzmWIss8F1SBf93O8wPiM3V2OOpVtbM0IDYylbLPZyQh823dAyLGNJ4ccEZw3V",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": null,
        "webhook_username": null,
        "webhook_password": null,
        "webhook_url": null,
        "payment_created_enabled": null,
        "payment_succeeded_enabled": null,
        "payment_failed_enabled": null,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null,
        "multiple_webhooks_list": [
            {
                "webhook_endpoint_id": "whe_UMn40KCSWVWcVT30C5MY",
                "webhook_url": "https://example.com/webhook2",
                "events": [
                    "mandate_revoked",
                    "refund_succeeded",
                    "dispute_expired",
                    "payment_succeeded",
                    "refund_failed"
                ],
                "status": "inactive"
            }
        ]
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
3. Delete webhook endpoint (marks the status to be deprecated)
curl --location --request DELETE 'http://localhost:8080/account/merchant_1770066678/business_profile/pro_Bgptl6v324V9Mkg5EZFg/webhooks/whe_UMn40KCSWVWcVT30C5MY' \
--header 'api-key: dev_pg81ddvK4zXUqdoHjGr991KKIuFLINb2I95jce4YYwbpHX5YO2WIR9mjsTiwT7Om'

Response:

{
    "merchant_id": "merchant_1770066678",
    "profile_id": "pro_Bgptl6v324V9Mkg5EZFg",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "4oJzmWIss8F1SBf93O8wPiM3V2OOpVtbM0IDYylbLPZyQh823dAyLGNJ4ccEZw3V",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": null,
        "webhook_username": null,
        "webhook_password": null,
        "webhook_url": null,
        "payment_created_enabled": null,
        "payment_succeeded_enabled": null,
        "payment_failed_enabled": null,
        "payment_statuses_enabled": null,
        "refund_statuses_enabled": null,
        "payout_statuses_enabled": null,
        "multiple_webhooks_list": [
            {
                "webhook_endpoint_id": "whe_UMn40KCSWVWcVT30C5MY",
                "webhook_url": "https://example.com/webhook2",
                "events": [
                    "refund_failed",
                    "refund_succeeded",
                    "dispute_expired",
                    "mandate_revoked",
                    "payment_succeeded"
                ],
                "status": "deprecated"
            }
        ]
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
4.Fetching all webhooks for a profile
curl --location 'http://localhost:8080/account/merchant_1770066678/business_profile/pro_Bgptl6v324V9Mkg5EZFg/webhooks' \
--header 'api-key: dev_pg81ddvK4zXUqdoHjGr991KKIuFLINb2I95jce4YYwbpHX5YO2WIR9mjsTiwT7Om'

Response:

{
    "webhooks": [
        {
            "webhook_endpoint_id": "whe_UMn40KCSWVWcVT30C5MY",
            "webhook_url": "https://example.com/webhook2",
            "events": [
                "mandate_revoked",
                "refund_failed",
                "dispute_expired",
                "payment_succeeded",
                "refund_succeeded"
            ],
            "status": "deprecated"
        },
        {
            "webhook_endpoint_id": "whe_PZ7wbjideoMp0CHxWNGW",
            "webhook_url": "https://example.com/webhook3",
            "events": [
                "refund_succeeded",
                "payment_failed",
                "refund_failed",
                "payment_succeeded"
            ],
            "status": "active"
        }
    ]
}
5.Try to update deleted/deprecated endpoint
curl --location --request PUT 'http://localhost:8080/account/merchant_1770066678/business_profile/pro_Bgptl6v324V9Mkg5EZFg/webhooks/whe_UMn40KCSWVWcVT30C5MY' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_pg81ddvK4zXUqdoHjGr991KKIuFLINb2I95jce4YYwbpHX5YO2WIR9mjsTiwT7Om' \
--data '
{
    "events": [
        "payment_succeeded"
    ],
    "status": "inactive"
}'

Response:

{
    "error": {
        "type": "invalid_request",
        "message": "Webhook endpoint with id 'WebhookEndpointId(\"whe_UMn40KCSWVWcVT30C5MY\")' is deleted and cannot be updated. Create a new webhook instead.",
        "code": "IR_06"
    }
}

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@swetasharma03 swetasharma03 requested review from a team as code owners February 2, 2026 21:09
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 2, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/lock_utils.rs  43% smaller
  crates/router/src/routes/app.rs  10% smaller
  crates/api_models/src/admin.rs  0% smaller
  crates/hyperswitch_domain_models/src/business_profile.rs  0% smaller
  crates/router/src/core/admin.rs  0% smaller
  crates/router/src/routes/profiles.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller

@swetasharma03 swetasharma03 force-pushed the mul-webhooks/api-contract branch from b4c581e to 66785ba Compare February 3, 2026 07:07
@swetasharma03 swetasharma03 force-pushed the mul-webhooks/api-contract branch from 66785ba to 9c9b396 Compare February 3, 2026 07:07
@swetasharma03 swetasharma03 changed the base branch from main to mul-webhooks/pt-core February 4, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant