- Issue created by @rszrama
Drupal Commerce integrates with a variety of payment APIs that are functionally onsite (via embedded iframes) but have to be implemented as offite (due to API integration requirements). Classic examples are the Stripe Payment Element and Authorize.Net Accept Hosted payment gateways. I think PayPal's Smart Payment Buttons are similar.
The issue is that these APIs confirm payment by redirecting the customer to a success or failure URL on the shopping cart application after submission. We use the return to tokenize the payment method and, depending on the API, either defer to the payment process pane for payment processing or else capture payment and redirect to checkout completion ourselves.
Our merchant add payment form should support any payment API, but for the sake of this ticket, let's just assume we only expect to support a hybrid method like this for now. This is simpler than having to figure out how to support the various methods of redirection.
Ideally, we would just need one additional route, a controller at admin/commerce/orders/###/payments/add/return
. This controller would invoke the payment gateway plugin's relevant function but catch any redirect responses. The only challenge I see here is that we might need some way to save the selected transaction type and amount, but I'm not entirely certain ... it might depend on the payment API whether or not the values can be read from the form directly and used to provision / embed the relevant iframe.
In any case, let's do some research and decide if we need to essentially save the pending payment without a payment method, redirect to a admin/commerce/orders/###/payments/add/new-payment-method
route, and embed the iframes and / or open the modals from there.
Active
3.0
Payment