Skip to content

feat: add webhook configuration UI to Payment Settings#4587

Open
hs-control-center-bot wants to merge 9 commits intomainfrom
feat/webhook-configuration-ui
Open

feat: add webhook configuration UI to Payment Settings#4587
hs-control-center-bot wants to merge 9 commits intomainfrom
feat/webhook-configuration-ui

Conversation

@hs-control-center-bot
Copy link
Copy Markdown
Collaborator

Type of Change

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

Description

Add a comprehensive Webhook Configuration tab to the Payment Settings page, allowing merchants to configure all webhook-related settings directly from the dashboard instead of using the API.

Changes:

New file:

  • PaymentSettingsWebhookConfiguration.res — New tab component with 3 sections:
    • Webhook Endpoint Configuration: URL, version, username, password fields
    • Automatic Event Triggers: Toggle switches for payment created/succeeded/failed
    • Advanced Status Configuration: Multi-select dropdowns for payment statuses (15 values), refund statuses (5 values), and payout statuses (13 values)

Type updates (common, V1, V2):

  • Added payment_statuses_enabled, refund_statuses_enabled, payout_statuses_enabled to webhookDetails types
  • Expanded webhookDetailsRequest_v1 and webhookDetailsRequest_v2 from just webhook_url to include all 10 webhook fields

Utils updates:

  • Updated constructWebhookDetailsObject in all 3 utils to parse new fields
  • Updated constructWebhookDetailsRequestObject in V1 and V2 to send all webhook fields in the request payload
  • Updated V1/V2 webhook-to-common type mappers

UI updates:

  • Added field definitions in PaymentSettingsRevampedHelper.res
  • Updated parseBusinessProfileForPaymentBehaviour to populate all webhook fields
  • Added "Webhook Configuration" tab to PaymentSettingsRevamped.res
  • Moved webhook URL from Payment Behaviour tab to the new dedicated tab

Motivation and Context

Closes #4584

Merchants currently need to manually call the Business Profile Update API to configure webhook settings. This change provides a self-service UI for all webhook configuration, eliminating API dependency.

How did you test it?

  • Manual verification of ReScript compilation via pre-commit hooks
  • Verified all type definitions are consistent across common, V1, and V2 interfaces

Where to test it?

  • INTEG
  • SANDBOX
  • PROD

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

Add a comprehensive Webhook Configuration tab to the Payment Settings
page, allowing merchants to configure webhook endpoint, authentication,
event triggers, and granular status-based event selection directly from
the dashboard.

Closes #4584

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hs-control-center-bot hs-control-center-bot requested a review from a team as a code owner March 25, 2026 18:21
@semanticdiff-com
Copy link
Copy Markdown

Review changes with  SemanticDiff

control-center-bot and others added 8 commits March 26, 2026 13:12
Add explicit return type annotations to constructWebhookDetailsObject in V1/V2
utils to disambiguate from webhookDetailsRequest types that now share the same
fields. Add missing webhook status fields to default business profile record.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use parsed profile data for webhook form initial values so username,
password, and version fields are always present. Remove fixed dropdown
direction on payout statuses to allow auto-detection of viewport space.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These sensitive fields should not be prefilled from the profile data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ser autofill

Browser force-autofills login credentials into fields with type="password"
regardless of autocomplete="off" or missing name attributes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove statuses that don't map to webhook EventTypes in the backend:
- Payment: remove requires_payment_method, requires_confirmation; add partially_captured_and_processing
- Refund: keep only failure, success
- Payout: keep only success, failed, cancelled, initiated, expired, reversed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These were removed to prevent prefill but the actual issue was browser
autofill (fixed by removing type="password"). Saved values should display.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…l values

setOptionString skips None values entirely, leaving the form fields
uninitialized. setDictNull always sets the field (value or null),
consistent with how webhook_url and webhook_version are handled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…emove redundant module prefixes

Move the shared utility to LogicUtils since it's generic, remove
duplicates from V1/V2 utils, and drop unnecessary
BusinessProfileInterfaceUtils prefixes where the module is already
opened.
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.

[TASK] Add webhook configuration UI to Payment Settings

1 participant