Suggested answer

A hook in B2C Commerce is a named extension point that allows cartridges to plug custom logic into the platform without modifying core code. Hooks are registered in a cartridge's package.json under a hooks property that points to a JSON file listing hook IDs and JavaScript module paths.

For payment integration, the platform defines the hook group dw.order.payment with the following key hook points:

1. Handle — called when the customer submits payment information on the billing step; used to save payment instrument data to the basket
2. Authorize — called when the order is being placed; used to call the payment gateway and capture or authorise funds
3. ValidatePaymentInstruments — validates stored payment instruments on the basket

The custom payment cartridge implements these methods, and the Payment Processor is registered in Business Manager under Merchant Tools > Ordering > Payment Processors. The storefront checkout then routes to the custom processor based on the payment method selected.

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.