0

When I want to create an order and complete payment on behalf of customer as an admin, I have all the flexibility a customer has, except, now I don't have option to any offsite payment gateway. The only visible options are onsite payment gateways and manual payment gateways. I looked in the documentation but couldn't find anything about it. I figured it was permission issue, but since I was user 1, I had access to everything, so it probably is caused by the way offsite payment gateway is created

Is there a way to achieve allow admin to fulfill offsite payment in Drupal commerce?

On line 124 of PaymentAddForm in commerce_payment I found the code responsible for filtering out offsite payment gateway.

$payment_gateways = array_filter($payment_gateways, function ($payment_gateway) {
/** @var \Drupal\commerce_payment\Entity\PaymentGateway $payment_gateway */
     return !($payment_gateway->getPlugin() instanceof OffsitePaymentGatewayInterface);
});

When I make it return as TRUE all the time, I can now see the offline payment gateway option for admin, however the gateway is not usable, as it requires a plugin form class. Has anyone successfully created offsite payment gateway usable by admin?

  • Commerce provides no ability for an admin to create an offsite payment. You would need to code this yourself. – Bojan Zivanovic Oct 7 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.