Overview
Theinbound property handles incoming webhook notifications from payment providers. This optional route receives asynchronous updates about payment status changes, such as when a pending payment is approved or when a customer completes a bank invoice payment.
Property signature
Type definition
When to use inbound
Implement theinbound handler when your payment provider:
Sends webhooks
Provider sends HTTP callbacks for payment status updates
Async payments
Supports asynchronous payment methods like bank transfers or invoices
3D Secure
Notifies completion of redirect-based authentication
Status changes
Reports chargebacks, disputes, or other post-settlement events
Implementation
The test suite example showsinbound as undefined:
Common scenarios
Async payment approval
Handle notifications when a pending payment is approved:Bank invoice payment
Handle notifications when a customer pays a bank invoice:3D Secure completion
Handle notifications after 3D Secure authentication:Chargeback notification
Handle chargeback notifications (informational):Security considerations
Signature validation
Always validate webhook signatures to prevent fraudulent requests:IP whitelisting
Restrict webhooks to known provider IPs:Error handling
Invalid signature
Invalid signature
Return 401 for invalid signatures:
Unknown payment
Unknown payment
Return 404 if payment doesn’t exist:
Duplicate webhook
Duplicate webhook
Return 200 for duplicate webhooks (idempotency):
Processing error
Processing error
Return 500 for internal errors, provider will retry:
Best practices
- Always validate signatures to ensure webhooks are from your payment provider.
- Implement idempotency by tracking processed webhook IDs to handle duplicate deliveries.
- Return 200 quickly - process webhooks asynchronously if they require heavy operations.
- Log all webhooks for debugging and audit trails.
- Handle unknown events gracefully - return 200 even for unrecognized event types.
- Use the callback mechanism to notify VTEX of status changes for pending payments.
- Implement retry logic on your side if callback to VTEX fails.
- Monitor webhook health - alert if webhooks stop arriving or fail frequently.
Testing webhooks
Test webhook handling in your development environment:Related routes
- authorize() - Initial authorization that may complete via webhook
- settle() - Settlement that may trigger settlement webhooks
- refund() - Refunds that may generate refund webhooks