5

Magento2 create order page

I have an invoice payment method. The customer's call center should be able to create orders from backend and add this specific payment method to the order. The payment method is a gateway, which then creates the invoice to the finance company's system.

How do I implement this?

  • 1
    you have to add products first then you can see payment methods. – Nitesh Mar 11 '17 at 8:00
  • is it possible magento 1 – user51361 May 29 '17 at 9:28
4

At first, your payment method should be available for usage in Admin panel and you need to specify can_use_internal property in your payment method YourCustomPayment/etc/config.xml file:

<payment>
    <your_custom_payment_method_code>
        <model>YourCustomPaymentMethodFacade</model>
        ...
        <can_use_internal>1</can_use_internal>
    </your_custom_payment_method_code>
</payment>

On the next step, you need to create block class, depends on your integration it will extend \Magento\Payment\Block\Form\Cc or \Magento\Payment\Block\Form.

And, after block is created, you need to create template view for this block and specify it in the layout for billing form (YourPayment/view/adminhtml/layout/sales_order_create_index.xml):

<body>
    <referenceBlock name="order_create_billing_form">
        <action method="setMethodFormTemplate">
            <argument name="method" xsi:type="string">your_custom_payment_method_code</argument>
            <argument name="template" xsi:type="string">Magento_YourCustomPayment::form/cc.phtml</argument>
        </action>
    </referenceBlock>
</body>

And for YourPayment/view/adminhtml/layout/sales_order_create_load_block_billing_method.xml

<body>
    <referenceBlock name="order.create.billing.method.form">
        <action method="setMethodFormTemplate">
            <argument name="method" xsi:type="string">your_custom_payment_method_code</argument>
            <argument name="template" xsi:type="string">Magento_YourCustomPayment::form/cc.phtml</argument>
        </action>
    </referenceBlock>
</body>

For more details, please, see my answer How to add custom payment gateway extension in magento2.

UPD This and this topics describe how to configure payment method for Adminl panel.

  • Thanks, I think I got this. I would need to trigger some actions (call to gateway, etc) after Submit order, how can I hook up? – Tero Lahtinen Nov 23 '16 at 10:00
  • @TeroLahtinen, please, see my updated answer. – joni jones Nov 23 '16 at 10:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.