0

I have my custom payment my_offsite_custom_payment method and onepage-checkout page modified in xml file below.

Before I display that payment method on checkout page I need to get extra data from backend to check what other options have merchant. After getting that data from backend I need to display it with that Payment option.

Could anybody help me to achieve that?

checkout_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <head>
        <css src="Custom_Payment::css/offsite-custom.css" />
    </head>
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="billing-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="payment" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="renders" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <item name="payment-custom" xsi:type="array">
                                                                    <item name="component" xsi:type="string">My_Payment/js/view/payment/custom</item>
                                                                    <item name="methods" xsi:type="array">                                                                      
                                                                        <item name="my_offsite_custom_payment" xsi:type="array">
                                                                            <item name="isBillingAddressRequired" xsi:type="boolean">true</item>
                                                                        </item>                                                                        
                                                                    </item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
0

To change load order, you would need to add sequence in your Custom Module etc/module.xml file. And add 'Magento_Backend' there.

Check devdocs here, that how does it load sequence work : https://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/module-load-order.html

| improve this answer | |
0

I solved that issue by creating observer with type: sales_order_place_after in etc/events.xml

<event name="sales_order_place_after">
    <observer name="custom_end_order" instance="MyModule\Payment\Observer\CustomPaymentObserver" />
</event>

than I implemented in observer:

$paymentInfo->setAdditionalInformation(['stuff here']);

this additional information was available in javascript.

| improve this answer | |

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.