Problem/Motivation
The Authorize only, and Authorize and capture transaction mode settings are global in the payment process within the default checkout flow in Drupal 8.
Site builders should be able to utilize different transaction modes according to the payment gateway's conditional criteria. Some examples could be:
- Large transactions that the site owner would like to verify (orders over $10,000 etc)
- International purchases that might be high risk, or that might turn out to be unable to be fulfilled
- Specific products that could have a tendency to be delayed in fulfillment
- Billing/shipping mismatch verification
Proposed resolution
If we move the transaction mode settings into the applicable gateways, we can then easily leverage the gateway conditions for the payments methods in determining when to Auth only, and when to Auth and capture.
@mglaman also mentioned in slack chat including an override feature at the checkout flow for folks who want global settings instead.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3178226-5.patch | 2.91 KB | tonytheferg |
| #5 | Screenshot (526).png | 16.9 KB | tonytheferg |
Comments
Comment #2
mglamanI agree. We should add the setting to payment gateways. A lot of times I forget, even, we customize it on checkout.
This issue helps us realign with the most common use case. Someone has one payment gateway (maybe two) and one checkout flow.
The special use case should be overriding the transaction type per-checkout flow. Such as a digital checkout. Most users probably have a mixed checkout flow that would use the default.
So we need to add a capture setting to the payment gateway configuration schema
The form can say some diddy about how payments create with this gateway will use that mode. But it can be overridden per-checkout flow instance.
In the PaymentProcess pane we need another option for capture. Basically "Use default transaction mode". Some kind of checkbox which hides the radios.
Then anywhere we check for the
capturevalue we'll need to check if default and pull from the payment gatewayWe could initialize a
$capturevariable below these linesSomething like
Comment #3
lisastreeter commentedIt would be helpful if there was also a way to control the transaction mode apart from the gateways. A third-party fraud detection service could be used during checkout to pre-authorize the payment transaction. If the responses returned by the detection service include "pending" or "under review" in addition to strict approve/deny results, we'd want to set the transaction mode to "authorize only" instead of the default "authorize and capture" for pre-approved transactions.
Perhaps instead of:
$capture = $this->configuration['capture'] ?? $payment_gateway_plugin->getTransactionMode()Create a new method for the checkout pane with default implementation that could be overridden by extending the class:
And then this:
$capture = $this->configuration['capture'] ?? $this->getTransactionCapture($payment_gateway_plugin);Comment #4
tonytheferg commentedWe should leave the checkout flow setting in place as a global setting, and then allow it to be overridden on the gateway level. Then there won't be any loss of functionality nor backwards compatibility issues.
Comment #5
tonytheferg commentedTossing a patch that just adds the schema, and form stuff to authnet.js, and adding a picture for thoughts on UX.

My thought is that the
capturesetting is only respected whenoverride_captureis set toTRUE.The patch doesn't add any logic to check the
override_capturesetting just yet.Wanted to see if this might be an acceptable approach first.
Comment #6
tonytheferg commentedNR just to see if the UX might work as a general approach.
Noticed this is wrong from my copying from accept.js.
Comment #7
mglamanDumping some thoughts. I saw this Slack convo and it rolled in my brain yesterday afternoon
When we first added the auth or auth+capture setting, in hindsight I wish we kept it on the payment gateway and then one of the following:
For backwards compatibility, #2 is the best. Whereas #1 provides better visibility (possibly, we don't show conditions on the gateway collection list.)
So the gateway should dictate default behavior. Then the checkout flow can have:
- Use default behavior
- Only authorize, overriding defaults
- Always capture, overriding defaults