QuestionQ9

Customize Commerce features

An Adobe Commerce Architect must customize the workflow for a monthly-installments payment extension. The extension is supplied by a partner contracted with the default website Payment Service Provider (PSP), which has its own legacy extension—a module that uses a deprecated payment method.

The installments payment partner only manages payment initialization and then delegates capture execution to the PSP. After the amount is successfully captured, the PSP notifies the website by webhook. The webhook’s sole purpose is to create an “invoice” and save the “capture information” for later refund requests through the PSP itself.

The Architect needs the simplest solution to achieve the requested behavior.

Which solution should the Architect implement?

  • A Add a plugin before the $invoice->capture() and change its input to prevent the call of the $payment->capture()
  • B Change the can_capture attribute for the payment method under config.xml to be <can_capture>0</can_capture>
  • C Declare a capture command with type Magento\Payment\Gateway\Command\NullCommand for the payment method CommandPool in di.xml
Explanation

A NullCommand configured for the payment method’s capture command makes the payment gateway capture action a no-op, so Adobe Commerce can create the invoice after the PSP webhook without issuing a second capture request to the PSP. Payment gateway actions are configured in DI and added to the method’s command pool; capture is the operation that withdraws a previously authorized amount.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!