Showing results for 
Search instead for 
Did you mean: 

The page for callbacks from the payment system

The page for callbacks from the payment system

I am writing to the module of payment gateway for Magento 2. I cannot understand what the url for the callback of the payment system. Is there a page created for it? The form for payment system is showing on the page /checkout/onepage/success/

But the url to return, I can not find in the structure chekout and payment modules. Or I can not understand what they are.


Re: The page for callbacks from the payment system

Hi @wallone,



I wasn't able to follow your question. Could you please provide more information / code samples / screenshots to be able to help you?

Best regards.

If my answer was useful, please give "Kudos" to this post.
If my answer helps you to resolve the problem, click on "Accept as Solution".

Re: The page for callbacks from the payment system

I need to send the post method of data to the payment system page. I create the form on the page  /checkout/onepage/success/ 

        function (
                redirectOnSuccessAction) {
            'use strict';
            return Component.extend({
                defaults: {
                    template: '***'
                 * Place order.
                contineOrder: function (data, event) {
                    var self = this;

                    if (event) {
                    if (this.validate() && additionalValidators.validate()) {
                        if (self.redirectAfterPlaceOrder) {
                        return true;
                    return false;


<page xmlns:xsi="" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <title>Success Page</title>
        <referenceContainer name="content">
            <block class="***\Payment\Block\Form\CheckoutResult" name="checkout.success" template="form/result_chekout.phtml" cacheable="false"/>
        <referenceContainer name="">
            <block class="***\Payment\Block\Form\CheckoutResult" name="onepage.success.result_chekout"/>


<div class="checkout-success">
    <div class="w1 button">
        <form action="<?php echo $block->getApiUrl(); ?>" method="POST">
          <?php foreach ($block->getFormPaymentsArray($block->getLastRealOrder()) as $key => $value){ ?>
            <?php if(is_array($value)){
              foreach ($value as $v) {?>
                <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $v; ?>"></input>
              <?php }?>
            <?php }
              <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"></input>
            <?php }?>
          <?php }?>
          <button class="action primary continue" type="submit">Pay</button>

But I don't know on what page to go back to the site from the payment system

Re: The page for callbacks from the payment system

Usually when redirecting to a payment page on a Payment Provider server you have to pass redirectUrl parameter. When Payment Provider processes payment form it triggers redirectUrl of your website. The redirectUrl usually looks like where "paymentcode" is a name of your payment module. Of course you have to create route.xml to process this request, controller, Complete Command which will get results from Payment provider and change status of an Order to "Processing" or "Suspended Fraud" in case of Fraud checks etc.


In the result_checkout.phtml you can add JavaScript responsible for redirecting user to your desired page on a website.