Workflows
processPayoutWebhookActionWorkflow
This documentation provides a reference to theprocessPayoutWebhookActionWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow processes webhook events from the payout provider (e.g., Stripe Connect) and takes appropriate actions based on the webhook type. Currently, it handles account authorization events by updating the payout account status to active.
Source code
Examples
- Subscriber
packages/modules/b2c-core/src/subscribers/payout-webhook.ts
Steps
- updatePayoutAccountStep: Updates the payout account status when the account is authorized.
Input
The webhook action and data.
Output
This workflow does not return a value.Steps
createPayoutReversalStep
Creates a reversal (refund) for a payout that was previously processed. This is typically used when an order is canceled after the seller has already been paid out. The step handles errors gracefully and returns both the reversal result and error status. Source codeExamples
- Cancel Order Workflow
packages/modules/b2c-core/src/workflows/order/workflows/cancel-order.ts
Input
The payout reversal details.
Output
updatePayoutAccountStep
Updates a payout account’s details. This step includes a compensation function that restores the previous account state if a subsequent step in the workflow fails, ensuring data consistency. Source codeExamples
- Webhook Processing
packages/modules/b2c-core/src/workflows/payout/workflows/process-payout-webhook-action.ts
Input
The payout account updates.
Output
The updated payout account.