feat(core): Support for multiple outgoing webhooks added
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
In the current system, merchants can configure only one webhook endpoint per profile. This PR introduces support for configuring multiple webhook endpoints based on the event_type. These changes include modifications to the database schema and alterations in the webhook triggering logic.
In payments.rs (for other flows as well), instead of triggering a single webhook directly, a bulk_outgoing_webhook job is now created. When this job is executed, it triggers multiple webhooks. Additionally, for each webhook, a corresponding retry_job is created in the process_tracker, ensuring that any failed webhook deliveries can be retried.
Database Schema Changes
-
Business Profile Schema Update: The webhook_details column in the business_profile table is being updated from a JSON object to an array of JSON objects. This will allow each business profile to store multiple webhook endpoints that can be associated with different event types.
-
Merchant Account Schema Update: In addition to the business_profile table, the
merchant_accounttable will also include awebhook_detailsfield to store webhook configurations for the merchant. Similar to the changes in the business_profile table, this field will be updated to store an array of webhook configurations rather than a single configuration. -
How old data would work with new code? Suppose we have webhook_details filled as
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true,
"multiple_webhooks_list": null
}
We have three functions which fetches webhook_details for outgoing_webhook_workflow.
-
get_webhook_details_for_event_type(): Here ifmultiple_webhooks_listis null, a struct multipleWebhooksList is created with present details and it is used up increate_event_and_trigger_outgoing_webhook, assuming that the single url present will receive webhooks for all events. -
get_webhook_detail_by_webhook_endpoint_id(): If webhook_endpoint_idis None, it represents an older form of data, and hencewebhook_url` present is returned. -
get_idempotent_event_id(): Previous version of this fn formed id with form{primary_object_id}_{event_type}, now it is base encoded of{primary_object_id}_{event_type}_{webhook_endpoint_id}. In casewebhook_endpoint_idpassed is None, it refers to older form of data, then id generated would be base64 of{primary_object_id}_{event_type}. -
How already stored tasks stored in process_tracker work? If the task is already stored, it means
trigger_outgoing_webhook_bulk_workflow()will not be called for that outgoing_webhook. Fortrigger_outgoing_webhook_retry_workflow(), granular description of functions used here are described above forget_idempotent_event_id,get_webhook_detail_by_webhook_endpoint_id
The update ensures backward compatibility, as existing records may still use the old schema (storing a single webhook configuration).
Additional Changes
- [x] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
- Merchant account create (with three webhook endpoints configured, two endpoints are correct and one is wrong to test automatic retry)
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
"merchant_id": "merchant_1748463901",
"locker_id": "m0010",
"merchant_name": "NewAge Retailer",
"merchant_details": {
"primary_contact_person": "John Test",
"primary_email": "[email protected]",
"primary_phone": "sunt laborum",
"secondary_contact_person": "John Test2",
"secondary_email": "[email protected]",
"secondary_phone": "cillum do dolor id",
"website": "https://www.example.com",
"about_business": "Online Retail with a wide selection of organic products for North America",
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "john",
"last_name": "Doe"
}
},
"return_url": "https://google.com/success",
"webhook_details": {
"multiple_webhooks_list": [
{
"webhook_url": "https://webhook.site/6f2bb1bd-dbb9-432c-b4a2-c76b801f2609",
"events": [
"payment_succeeded"
]
},
{
"webhook_url": "https://webhook.site/381773c7-c3bd-406e-bda3-dfc5d2fea979",
"events": [
"payment_succeeded",
"refund_failed"
]
},
{
"webhook_url": "https://webhook.site/automatic-retry-test",
"events": [
"refund_failed",
"payment_succeeded"
]
}
]
},
"sub_merchants_enabled": false,
"parent_merchant_id": "merchant_123",
"metadata": {
"city": "NY",
"unit": "245"
},
"primary_business_details": [
{
"country": "US",
"business": "default"
}
]
}'
Response
{
"merchant_id": "merchant_1748463854",
"merchant_name": "NewAge Retailer",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "03qU2TjCh216DXE1GU6oJpdzxQXmT80KAU8hQn74RZZEvRaRXO4Cmckj49PLX6m4",
"redirect_to_merchant_with_http_post": false,
"merchant_details": {
"primary_contact_person": "John Test",
"primary_phone": "sunt laborum",
"primary_email": "[email protected]",
"secondary_contact_person": "John Test2",
"secondary_phone": "cillum do dolor id",
"secondary_email": "[email protected]",
"website": "https://www.example.com",
"about_business": "Online Retail with a wide selection of organic products for North America",
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "john",
"last_name": "Doe"
}
},
"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,
"multiple_webhooks_list": [
{
"webhook_endpoint_id": "whe_qolIdtZFQfWNmUg2i7X2",
"webhook_url": "https://webhook.site/6f2bb1bd-dbb9-432c-b4a2-c76b801f2609",
"events": [
"payment_succeeded"
],
"status": "active"
},
{
"webhook_endpoint_id": "whe_9ugRQr1n3vO4ehmJ80Kx",
"webhook_url": "https://webhook.site/381773c7-c3bd-406e-bda3-dfc5d2fea979",
"events": [
"payment_succeeded",
"refund_failed"
],
"status": "active"
},
{
"webhook_endpoint_id": "whe_3zAXAGH81VGY6Cw8lWLK",
"webhook_url": "https://webhook.site/automatic-retry-test",
"events": [
"payment_succeeded",
"refund_failed"
],
"status": "active"
}
]
},
"payout_routing_algorithm": null,
"sub_merchants_enabled": false,
"parent_merchant_id": null,
"publishable_key": "pk_dev_9ac4425918a24870bb5cd87ebf9b8e76",
"metadata": {
"city": "NY",
"unit": "245",
"compatible_connector": null
},
"locker_id": "m0010",
"primary_business_details": [
{
"country": "US",
"business": "default"
}
],
"frm_routing_algorithm": null,
"organization_id": "org_aeXhfXk1juyUMg9C4cLp",
"is_recon_enabled": false,
"default_profile": "pro_UfVajfSqskx9FjWfP5cP",
"recon_status": "not_requested",
"pm_collect_link_config": null,
"product_type": "orchestration"
}
- Create payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_uCH6m5Obz9TWXaGyrw9HJCufkrvHewRUy0jiaD232wiwEE0UUztSwTdwPvNBKqam' \
--data-raw '{
"amount": 6540,
"currency": "USD",
"amount_to_capture": 6540,
"confirm": true,
"profile_id": "pro_UfVajfSqskx9FjWfP5cP",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"authentication_type": "no_three_ds",
"setup_future_usage": "on_session",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "[email protected]",
"phone": "9999999999",
"phone_country_code": "+1"
},
"customer_id": "customer123",
"phone_country_code": "+1",
"routing": {
"type": "single",
"data": "stripe"
},
"description": "Its my first payment request",
"return_url": "https://google.com",
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4111111111111111",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_cvc": "737"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"order_details": [
{
"product_name": "Apple iphone 15",
"quantity": 1,
"amount": 6540,
"account_name": "transaction_processing"
}
],
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"browser_info": {
"user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
"accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "128.0.0.1"
},
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "125.0.0.1",
"user_agent": "amet irure esse"
}
},
"connector_metadata": {
"noon": {
"order_category": "pay"
}
},
"payment_link": false,
"payment_link_config": {
"theme": "",
"logo": "",
"seller_name": "",
"sdk_layout": "",
"display_sdk_only": false,
"enabled_saved_payment_method": false
},
"payment_type": "normal",
"request_incremental_authorization": false,
"merchant_order_reference_id": "test_ord",
"session_expiry": 900
}'
Response
Payment created with id pay_6vacj5lnQX9BKSLeXYUy
{
"payment_id": "pay_6vacj5lnQX9BKSLeXYUy",
"merchant_id": "merchant_1748463854",
"status": "succeeded",
"amount": 6540,
"net_amount": 6540,
"shipping_cost": null,
"amount_capturable": 0,
"amount_received": 6540,
"connector": "adyen",
"client_secret": "pay_6vacj5lnQX9BKSLeXYUy_secret_GxdazMB1wOxZdf6UJ11l",
"created": "2025-05-28T20:24:28.821Z",
"currency": "USD",
"customer_id": "customer123",
"customer": {
"id": "customer123",
"name": "John Doe",
"email": "[email protected]",
"phone": "9999999999",
"phone_country_code": "+1"
},
"description": "Its my first payment request",
"refunds": null,
"disputes": null,
"mandate_id": null,
"mandate_data": null,
"setup_future_usage": "on_session",
"off_session": null,
"capture_on": null,
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "1111",
"card_type": null,
"card_network": null,
"card_issuer": null,
"card_issuing_country": null,
"card_isin": "411111",
"card_extended_bin": null,
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": null,
"payment_checks": null,
"authentication_data": null
},
"billing": null
},
"payment_token": null,
"shipping": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
},
"email": "[email protected]"
},
"order_details": [
{
"brand": null,
"amount": 6540,
"category": null,
"quantity": 1,
"tax_rate": null,
"product_id": null,
"product_name": "Apple iphone 15",
"product_type": null,
"sub_category": null,
"product_img_link": null,
"product_tax_code": null,
"total_tax_amount": null,
"requires_shipping": null
}
],
"email": "[email protected]",
"name": "John Doe",
"phone": "9999999999",
"return_url": "https://google.com/",
"authentication_type": "no_three_ds",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"next_action": null,
"cancellation_reason": null,
"error_code": null,
"error_message": null,
"unified_code": null,
"unified_message": null,
"payment_experience": null,
"payment_method_type": "credit",
"connector_label": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"allowed_payment_method_types": null,
"ephemeral_key": {
"customer_id": "customer123",
"created_at": 1748463868,
"expires": 1748467468,
"secret": "epk_b857940df0a245ef8417f4423de61c14"
},
"manual_retry_allowed": false,
"connector_transaction_id": "GQ7N5P2BQCPFMZ65",
"frm_message": null,
"metadata": {
"udf1": "value1",
"login_date": "2019-09-10T10:11:12Z",
"new_customer": "true"
},
"connector_metadata": {
"apple_pay": null,
"airwallex": null,
"noon": {
"order_category": "pay"
},
"braintree": null,
"adyen": null
},
"feature_metadata": null,
"reference_id": "pay_6vacj5lnQX9BKSLeXYUy_1",
"payment_link": null,
"profile_id": "pro_UfVajfSqskx9FjWfP5cP",
"surcharge_details": null,
"attempt_count": 1,
"merchant_decision": null,
"merchant_connector_id": "mca_FzqxnIqNjwC9MRSHnl9p",
"incremental_authorization_allowed": false,
"authorization_count": null,
"incremental_authorizations": null,
"external_authentication_details": null,
"external_3ds_authentication_attempted": false,
"expires_on": "2025-05-28T20:39:28.821Z",
"fingerprint": null,
"browser_info": {
"language": "nl-NL",
"time_zone": 0,
"ip_address": "128.0.0.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"color_depth": 24,
"java_enabled": true,
"screen_width": 1536,
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"screen_height": 723,
"java_script_enabled": true
},
"payment_method_id": null,
"payment_method_status": null,
"updated": "2025-05-28T20:24:31.305Z",
"split_payments": null,
"frm_metadata": null,
"extended_authorization_applied": null,
"capture_before": null,
"merchant_order_reference_id": "test_ord",
"order_tax_amount": null,
"connector_mandate_id": null,
"card_discovery": "manual",
"force_3ds_challenge": false,
"force_3ds_challenge_trigger": false,
"issuer_error_code": null,
"issuer_error_message": null
}
After doing a payment with status succeeded, bulk webhook added to process_tracker
This bulk task, adds all the multiple outgoing webhooks (three for the merchant created) in process_tracker, two outgoing webhooks notified, one is pending as the endpoint was wrong
Three events created initially for corresponding tasks of process tracker above. One notification failed, so there is one more entry in events table for automatic retry.
Events created by process_tracker:
Two webhooks received in different endpoints which were correctly configured
- Manual retry to first webhook endpoint
curl --location --request POST 'http://localhost:8080/events/merchant_1748463854/evt_01971892575c7c5395780fbd740e6b00/retry' \
--header 'api-key: test_admin'
Response
{
"event_id": "evt_019718a1f5f170c3954a3fc958337e51",
"merchant_id": "merchant_1748463854",
"profile_id": "pro_UfVajfSqskx9FjWfP5cP",
"webhook_endpoint_id": "whe_qolIdtZFQfWNmUg2i7X2",
"object_id": "pay_6vacj5lnQX9BKSLeXYUy",
"event_type": "payment_succeeded",
"event_class": "payments",
"is_delivery_successful": false,
"initial_attempt_id": "evt_01971892575c7c5395780fbd740e6b00",
"created": "2025-05-28T20:42:36.914Z",
"request": {
"body": "{\"merchant_id\":\"merchant_1748463854\",\"event_id\":\"evt_01971892575c7c5395780fbd740e6b00\",\"event_type\":\"payment_succeeded\",\"content\":{\"type\":\"payment_details\",\"object\":{\"payment_id\":\"pay_6vacj5lnQX9BKSLeXYUy\",\"merchant_id\":\"merchant_1748463854\",\"status\":\"succeeded\",\"amount\":6540,\"net_amount\":6540,\"shipping_cost\":null,\"amount_capturable\":0,\"amount_received\":6540,\"connector\":\"adyen\",\"client_secret\":\"pay_6vacj5lnQX9BKSLeXYUy_secret_GxdazMB1wOxZdf6UJ11l\",\"created\":\"2025-05-28T20:24:28.821Z\",\"currency\":\"USD\",\"customer_id\":\"customer123\",\"customer\":{\"id\":\"customer123\",\"name\":\"John Doe\",\"email\":\"[email protected]\",\"phone\":\"9999999999\",\"phone_country_code\":\"+1\"},\"description\":\"Its my first payment request\",\"refunds\":null,\"disputes\":null,\"mandate_id\":null,\"mandate_data\":null,\"setup_future_usage\":\"on_session\",\"off_session\":null,\"capture_on\":null,\"capture_method\":\"automatic\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"last4\":\"1111\",\"card_type\":null,\"card_network\":null,\"card_issuer\":null,\"card_issuing_country\":null,\"card_isin\":\"411111\",\"card_extended_bin\":null,\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":null,\"payment_checks\":null,\"authentication_data\":null},\"billing\":null},\"payment_token\":null,\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"zip\":\"94122\",\"state\":\"California\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"},\"email\":\"[email protected]\"},\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"zip\":\"94122\",\"state\":\"California\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"},\"email\":\"[email protected]\"},\"order_details\":[{\"brand\":null,\"amount\":6540,\"category\":null,\"quantity\":1,\"tax_rate\":null,\"product_id\":null,\"product_name\":\"Apple iphone 15\",\"product_type\":null,\"sub_category\":null,\"product_img_link\":null,\"product_tax_code\":null,\"total_tax_amount\":null,\"requires_shipping\":null}],\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"9999999999\",\"return_url\":\"https://google.com/\",\"authentication_type\":\"no_three_ds\",\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"next_action\":null,\"cancellation_reason\":null,\"error_code\":null,\"error_message\":null,\"unified_code\":null,\"unified_message\":null,\"payment_experience\":null,\"payment_method_type\":\"credit\",\"connector_label\":null,\"business_country\":null,\"business_label\":\"default\",\"business_sub_label\":null,\"allowed_payment_method_types\":null,\"ephemeral_key\":null,\"manual_retry_allowed\":false,\"connector_transaction_id\":\"GQ7N5P2BQCPFMZ65\",\"frm_message\":null,\"metadata\":{\"udf1\":\"value1\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"},\"connector_metadata\":{\"apple_pay\":null,\"airwallex\":null,\"noon\":{\"order_category\":\"pay\"},\"braintree\":null,\"adyen\":null},\"feature_metadata\":null,\"reference_id\":\"pay_6vacj5lnQX9BKSLeXYUy_1\",\"payment_link\":null,\"profile_id\":\"pro_UfVajfSqskx9FjWfP5cP\",\"surcharge_details\":null,\"attempt_count\":1,\"merchant_decision\":null,\"merchant_connector_id\":\"mca_FzqxnIqNjwC9MRSHnl9p\",\"incremental_authorization_allowed\":false,\"authorization_count\":null,\"incremental_authorizations\":null,\"external_authentication_details\":null,\"external_3ds_authentication_attempted\":false,\"expires_on\":\"2025-05-28T20:39:28.821Z\",\"fingerprint\":null,\"browser_info\":{\"language\":\"nl-NL\",\"time_zone\":0,\"ip_address\":\"128.0.0.1\",\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"color_depth\":24,\"java_enabled\":true,\"screen_width\":1536,\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"screen_height\":723,\"java_script_enabled\":true},\"payment_method_id\":\"pm_x8ICuV0PsnuaK8ERCkxH\",\"payment_method_status\":\"active\",\"updated\":\"2025-05-28T20:24:31.305Z\",\"split_payments\":null,\"frm_metadata\":null,\"extended_authorization_applied\":null,\"capture_before\":null,\"merchant_order_reference_id\":\"test_ord\",\"order_tax_amount\":null,\"connector_mandate_id\":null,\"card_discovery\":\"manual\",\"force_3ds_challenge\":false,\"force_3ds_challenge_trigger\":false,\"issuer_error_code\":null,\"issuer_error_message\":null}},\"timestamp\":\"2025-05-28T20:25:33.276Z\"}",
"headers": [
[
"content-type",
"application/json"
],
[
"user-agent",
"Hyperswitch-Backend-Server"
],
[
"X-Webhook-Signature-512",
"b81594a37e46cd58c24c04d2b96aaa658c82d0007f3c967c1f62d8bb9d72f1d418bec651900fc0076816720f2dc0d6bb93cbd92915b00b68d6c6eca7772ca84a"
]
]
},
"response": {
"body": "This URL has no default content configured. <a href=\"https://webhook.site/#!/edit/6f2bb1bd-dbb9-432c-b4a2-c76b801f2609\">Change response in Webhook.site</a>.",
"headers": [
[
"server",
"nginx"
],
[
"content-type",
"text/html; charset=UTF-8"
],
[
"transfer-encoding",
"chunked"
],
[
"x-request-id",
"fd416e97-ea7b-4cc2-9678-ee7fcd68849e"
],
[
"x-token-id",
"6f2bb1bd-dbb9-432c-b4a2-c76b801f2609"
],
[
"cache-control",
"no-cache, private"
],
[
"date",
"Wed, 28 May 2025 20:42:37 GMT"
]
],
"status_code": 200,
"error_message": null
},
"delivery_attempt": "manual_retry"
}
Webhook received for manual retry in first endpoint
- Manual retry to second webhook endpoint
curl --location --request POST 'http://localhost:8080/events/merchant_1748463854/evt_01971892575c7c5395780fc76469ec8c/retry' \
--header 'api-key: test_admin'
Response
{
"event_id": "evt_01971894d5157c22a1e1e148e6518bda",
"merchant_id": "merchant_1748463854",
"profile_id": "pro_UfVajfSqskx9FjWfP5cP",
"webhook_endpoint_id": "whe_9ugRQr1n3vO4ehmJ80Kx",
"object_id": "pay_6vacj5lnQX9BKSLeXYUy",
"event_type": "payment_succeeded",
"event_class": "payments",
"is_delivery_successful": false,
"initial_attempt_id": "evt_01971892575c7c5395780fc76469ec8c",
"created": "2025-05-28T20:28:16.535Z",
"request": {
"body": "{\"merchant_id\":\"merchant_1748463854\",\"event_id\":\"evt_01971892575c7c5395780fc76469ec8c\",\"event_type\":\"payment_succeeded\",\"content\":{\"type\":\"payment_details\",\"object\":{\"payment_id\":\"pay_6vacj5lnQX9BKSLeXYUy\",\"merchant_id\":\"merchant_1748463854\",\"status\":\"succeeded\",\"amount\":6540,\"net_amount\":6540,\"shipping_cost\":null,\"amount_capturable\":0,\"amount_received\":6540,\"connector\":\"adyen\",\"client_secret\":\"pay_6vacj5lnQX9BKSLeXYUy_secret_GxdazMB1wOxZdf6UJ11l\",\"created\":\"2025-05-28T20:24:28.821Z\",\"currency\":\"USD\",\"customer_id\":\"customer123\",\"customer\":{\"id\":\"customer123\",\"name\":\"John Doe\",\"email\":\"[email protected]\",\"phone\":\"9999999999\",\"phone_country_code\":\"+1\"},\"description\":\"Its my first payment request\",\"refunds\":null,\"disputes\":null,\"mandate_id\":null,\"mandate_data\":null,\"setup_future_usage\":\"on_session\",\"off_session\":null,\"capture_on\":null,\"capture_method\":\"automatic\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"last4\":\"1111\",\"card_type\":null,\"card_network\":null,\"card_issuer\":null,\"card_issuing_country\":null,\"card_isin\":\"411111\",\"card_extended_bin\":null,\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":null,\"payment_checks\":null,\"authentication_data\":null},\"billing\":null},\"payment_token\":null,\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"zip\":\"94122\",\"state\":\"California\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"},\"email\":\"[email protected]\"},\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"zip\":\"94122\",\"state\":\"California\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"},\"email\":\"[email protected]\"},\"order_details\":[{\"brand\":null,\"amount\":6540,\"category\":null,\"quantity\":1,\"tax_rate\":null,\"product_id\":null,\"product_name\":\"Apple iphone 15\",\"product_type\":null,\"sub_category\":null,\"product_img_link\":null,\"product_tax_code\":null,\"total_tax_amount\":null,\"requires_shipping\":null}],\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"9999999999\",\"return_url\":\"https://google.com/\",\"authentication_type\":\"no_three_ds\",\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"next_action\":null,\"cancellation_reason\":null,\"error_code\":null,\"error_message\":null,\"unified_code\":null,\"unified_message\":null,\"payment_experience\":null,\"payment_method_type\":\"credit\",\"connector_label\":null,\"business_country\":null,\"business_label\":\"default\",\"business_sub_label\":null,\"allowed_payment_method_types\":null,\"ephemeral_key\":null,\"manual_retry_allowed\":false,\"connector_transaction_id\":\"GQ7N5P2BQCPFMZ65\",\"frm_message\":null,\"metadata\":{\"udf1\":\"value1\",\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\"},\"connector_metadata\":{\"apple_pay\":null,\"airwallex\":null,\"noon\":{\"order_category\":\"pay\"},\"braintree\":null,\"adyen\":null},\"feature_metadata\":null,\"reference_id\":\"pay_6vacj5lnQX9BKSLeXYUy_1\",\"payment_link\":null,\"profile_id\":\"pro_UfVajfSqskx9FjWfP5cP\",\"surcharge_details\":null,\"attempt_count\":1,\"merchant_decision\":null,\"merchant_connector_id\":\"mca_FzqxnIqNjwC9MRSHnl9p\",\"incremental_authorization_allowed\":false,\"authorization_count\":null,\"incremental_authorizations\":null,\"external_authentication_details\":null,\"external_3ds_authentication_attempted\":false,\"expires_on\":\"2025-05-28T20:39:28.821Z\",\"fingerprint\":null,\"browser_info\":{\"language\":\"nl-NL\",\"time_zone\":0,\"ip_address\":\"128.0.0.1\",\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"color_depth\":24,\"java_enabled\":true,\"screen_width\":1536,\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"screen_height\":723,\"java_script_enabled\":true},\"payment_method_id\":\"pm_x8ICuV0PsnuaK8ERCkxH\",\"payment_method_status\":\"active\",\"updated\":\"2025-05-28T20:24:31.305Z\",\"split_payments\":null,\"frm_metadata\":null,\"extended_authorization_applied\":null,\"capture_before\":null,\"merchant_order_reference_id\":\"test_ord\",\"order_tax_amount\":null,\"connector_mandate_id\":null,\"card_discovery\":\"manual\",\"force_3ds_challenge\":false,\"force_3ds_challenge_trigger\":false,\"issuer_error_code\":null,\"issuer_error_message\":null}},\"timestamp\":\"2025-05-28T20:25:33.276Z\"}",
"headers": [
[
"content-type",
"application/json"
],
[
"user-agent",
"Hyperswitch-Backend-Server"
],
[
"X-Webhook-Signature-512",
"d63a92f145268741a83bf41db24769f401a000254906391bd581ca8b4be99734e5731711b693e8cfc44703014dfcc60fd73105f593ee7dbffe7687ee07134d4e"
]
]
},
"response": {
"body": "This URL has no default content configured. <a href=\"https://webhook.site/#!/edit/381773c7-c3bd-406e-bda3-dfc5d2fea979\">Change response in Webhook.site</a>.",
"headers": [
[
"server",
"nginx"
],
[
"content-type",
"text/html; charset=UTF-8"
],
[
"transfer-encoding",
"chunked"
],
[
"x-request-id",
"18b3a013-caf2-4667-ab91-29cffa99ce86"
],
[
"x-token-id",
"381773c7-c3bd-406e-bda3-dfc5d2fea979"
],
[
"cache-control",
"no-cache, private"
],
[
"date",
"Wed, 28 May 2025 20:28:17 GMT"
]
],
"status_code": 200,
"error_message": null
},
"delivery_attempt": "manual_retry"
}
Webhook received for manual retry in the second endpoint
- Updating business profile
curl --location 'http://localhost:8080/account/merchant_1742455203/business_profile/pro_P4LiydzsnrV6Sw6tKjie' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
"profile_name": "Update",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true,
"multiple_webhooks_list": [
{
"webhook_endpoint_id": "web_LxSxKD1m6c2bUfODoWLV",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"events": [
"payment_authorized",
"payment_succeeded",
],
"status": "active"
},
]
},
"metadata": 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,
"collect_shipping_details_from_wallet_connector": false,
"collect_billing_details_from_wallet_connector": false,
"is_connector_agnostic_mit_enabled": false,
"payout_link_config": null,
"outgoing_webhook_custom_http_headers": null
}'
Response
{
"merchant_id": "merchant_1742455203",
"profile_id": "pro_P4LiydzsnrV6Sw6tKjie",
"profile_name": "Update",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "7aRicO9KmdjjlJDuOkBAopiLwDSEd3gGlI9axVuLWJuyrzXVFvEAwwqNieVnpItV",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true,
"multiple_webhooks_list": [
{
"webhook_endpoint_id": "web_LxSxKD1m6c2bUfODoWLV",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"events": [
"payment_authorized",
"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
}
- Fetching profile
{
"merchant_id": "merchant_1742455203",
"profile_id": "pro_P4LiydzsnrV6Sw6tKjie",
"profile_name": "Update",
"return_url": "https://google.com/success",
"enable_payment_response_hash": true,
"payment_response_hash_key": "7aRicO9KmdjjlJDuOkBAopiLwDSEd3gGlI9axVuLWJuyrzXVFvEAwwqNieVnpItV",
"redirect_to_merchant_with_http_post": false,
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true,
"multiple_webhooks_list": [
{
"webhook_endpoint_id": "web_LxSxKD1m6c2bUfODoWLV",
"webhook_url": "https://webhook.site/04e616b8-b2c1-4a12-968f-7546ef0bb7fd",
"events": [
"payment_authorized",
"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
}
Checklist
- [x] I formatted the code
cargo +nightly fmt --all - [x] I addressed lints thrown by
cargo clippy - [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
Changed Files
https://github.com/juspay/hyperswitch/pull/7578#discussion_r2189318409 As adding new endpoints will increase complexity of the PR, we will be breaking out this PR into 5 new fresh PRs. CC: @SanchithHegde @Aishwariyaa-Anand