title: What is the link to redirect after successful payment at payment gateway in opencart?
body: <p>I've implemented payment module in Opencart based on BankTransfer module. 
  Requirement for payment gateway is to submit with get request a <strong>successurl</strong> and <strong>errorurl</strong>. Those URL are for successful order and canceled order. </p>
  
  <p>Algorithm: </p>
  
  <ol>
  <li>Customer gets to the order checkout. </li>
  <li>Click confirm order </li>
  <li>Gets redirected to localhost/opencart/testkzm.php, where values are printed out and there's a link with to which i should redirect in case of success. </li>
  </ol>
  
  <p><strong>QUESTION:</strong> What is the link to redirect after successful payment at payment gateway? </p>
  
  <p>Approach: 
  I've naively thought that <a href="http://example.com/opencart/index.php?route=checkout/success" rel="nofollow">http://example.com/opencart/index.php?route=checkout/success</a> is the success link. It's only shows confirmation message, but order is not placed in the system. I understand that there's no way to give external link that will automatically know which order to confirm, so should i pass encrypted unique values in successurl, so on return i can decrypt them and confirm order? </p>
  
  <p>Explanation of files: </p>
  
  <ul>
  <li>banktransfer.php is file opencart gets information from system such
  order id, amount of the order and etc.  </li>
  <li>banktransfer.tpl is template
  file for rendering page in browser.(Actual front-end) </li>
  <li>testkzm.php is
  simple file that i wrote to test that i get correct values from
  system.</li>
  </ul>
  
  <p>testkzm.php is
     simple file that i wrote to test that i get correct values from
     system.</p>
  
  <p>banktransfer.php in controller/payment </p>
  
  <pre><code> class ControllerPaymentBankTransfer extends Controller {
    protected function index() {
     $this-&gt;language-&gt;load('payment/bank_transfer');
  
     $this-&gt;data['text_instruction'] = $this-&gt;language-&gt;get('text_instruction');
     $this-&gt;data['text_description'] = $this-&gt;language-&gt;get('text_description');
     $this-&gt;data['text_payment'] = $this-&gt;language-&gt;get('text_payment');
  
     //Modified things for KZM
     $order_info = $this-&gt;model_checkout_order-&gt;getOrder($this-&gt;session-&gt;data['order_id']);
     $this-&gt;data['orderIdKZM'] = $this-&gt;session-&gt;data['order_id'];
     $this-&gt;data['amountKZM'] = $order_info['total'];
  
     $this-&gt;data['merchantIdKZM'] = $this-&gt;language-&gt;get('merchantIdKZM');
     $this-&gt;data['currencyKZM'] = $this-&gt;language-&gt;get('currencyKZM');
     $this-&gt;data['titleKZM'] = $this-&gt;language-&gt;get('titleKZM');
     $this-&gt;data['successuUlKZM'] = $this-&gt;language-&gt;get('successUrlKZM');
     $this-&gt;data['errorUrlKZM'] = $this-&gt;language-&gt;get('errorUrlKZM');
     $this-&gt;data['dateKZM'] = $this-&gt;language-&gt;get('dateKZM');
     $this-&gt;data['signstrKZM'] = $this-&gt;language-&gt;get('signstrKZM');
     $this-&gt;data['verKZM'] = $this-&gt;language-&gt;get('verKZM');
     //KZM
  
     $this-&gt;data['button_confirm'] = $this-&gt;language-&gt;get('button_confirm');
  
     $this-&gt;data['bank'] = nl2br($this-&gt;config-&gt;get('bank_transfer_bank_' . $this-&gt;config-&gt;get('config_language_id')));
  
     $this-&gt;data['continue'] = $this-&gt;url-&gt;link('checkout/success');
  
     if (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '/template/payment/bank_transfer.tpl')) {
      $this-&gt;template = $this-&gt;config-&gt;get('config_template') . '/template/payment/bank_transfer.tpl';
     } else {
      $this-&gt;template = 'default/template/payment/bank_transfer.tpl';
     } 
  
     $this-&gt;render(); 
    }
  
    public function confirm() {
     $this-&gt;language-&gt;load('payment/bank_transfer');
  
     $this-&gt;load-&gt;model('checkout/order');
  
     $comment  = $this-&gt;language-&gt;get('text_instruction') . "\n\n";
     $comment .= $this-&gt;config-&gt;get('bank_transfer_bank_' . $this-&gt;config-&gt;get('config_language_id')) . "\n\n";
     $comment .= $this-&gt;language-&gt;get('text_payment');
  
     $this-&gt;model_checkout_order-&gt;confirm($this-&gt;session-&gt;data['order_id'], $this-&gt;config-&gt;get('bank_transfer_order_status_id'), $comment, true);
    }
   }
  </code></pre>
  
  <p>banktransfer.tpl</p>
  
  <pre><code>&lt;h2&gt;&lt;?php echo $text_instruction; ?&gt;&lt;/h2&gt;
   &lt;div class="content"&gt;
      &lt;p&gt;&lt;?php echo $text_description; ?&gt;&lt;/p&gt;
      &lt;p&gt;&lt;?php echo $bank; ?&gt;&lt;/p&gt;
      &lt;p&gt;&lt;?php echo $text_payment; ?&gt;&lt;/p&gt;
      &lt;p&gt;&lt;?php echo $orderIdKZM; ?&gt;&lt;/p&gt;
      &lt;p&gt;
      &lt;?php 
       $titleKZM = $titleKZM.$orderIdKZM; 
         $merchantIdKZM = '23';
     $currencyKZM = 'KZT';
     $successUrlKZM = '';
     $erroUrlKZM = '';
     $dateKZM = $merchantIdKZM.$orderIdKZM.$amountKZM.$currencyKZM;
  
      ?&gt;&lt;/p&gt;
   &lt;/div&gt;
   &lt;div class="buttons"&gt;
     &lt;div class="right"&gt;
   &lt;form action="http://example.com/opencart/testkzm.php" method="get"&gt;
   &lt;input type="hidden" name="merchantIdKZM" value="&lt;?php echo $merchantIdKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="orderIdKZM" value="&lt;?php echo $orderIdKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="amountKZM" value="&lt;?php echo $amountKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="currencyKZM" value="&lt;?php echo $currencyKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="successUrlKZM" value="&lt;?php echo $successUrlKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="errorUrlKZM" value="&lt;?php echo $errorUrlKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="signstrKZM" value="&lt;?php echo $signstrKZM; ?&gt;"&gt;
   &lt;input type="hidden" name="verKZM"  value="&lt;?php echo $verKZM; ?&gt;"&gt;
  
   &lt;input type="button" value="&lt;?php echo $button_confirm; ?&gt;" id="button-confirm" class="button" /&gt;
   &lt;/form&gt;
       &lt;/div&gt;
   &lt;/div&gt;
   &lt;script type="text/javascript"&gt;&lt;!--
   $('#button-confirm-s').bind('click', function() {
    $.ajax({ 
     type: 'get',
     url: 'index.php?route=payment/bank_transfer/confirm',
     success: function() {
      location = '&lt;?php echo $continue; ?&gt;';
     }  
    });
   });
   //--&gt;&lt;/script
  </code></pre>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <p>testkzm.php </p>
  
  <pre><code>merchantID &lt;?php echo $_GET["merchantIdKZM"]; ?&gt;&lt;br&gt;
    orderID &lt;?php echo $_GET["orderIdKZM"]; ?&gt; &lt;br&gt; 
    amount &lt;?php echo $_GET["amountKZM"]; ?&gt;&lt;br&gt;
    currency &lt;?php echo $_GET["currencyKZM"]; ?&gt; &lt;br&gt; 
    successURL &lt;?php echo $_GET["successUrlKZM"]; ?&gt;&lt;br&gt;
    errorURL &lt;?php echo $_GET["errorUrlKZM"]; ?&gt; &lt;br&gt; 
    signstr &lt;?php echo $_GET["signstrKZM"]; ?&gt;&lt;br&gt;
    ver &lt;?php echo $_GET["verKZM"]; ?&gt; &lt;br&gt; 
  
    &lt;div class="buttons"&gt;
              &lt;div class="right"&gt;
            &lt;a href="http://example.com/opencart/index.php?route=checkout/success"&gt;asdfas&lt;/a&gt;
           &lt;/div&gt;
        &lt;/div&gt;
  </code></pre>