title: Postback and Return URL in Opencart
body: <p>I need help on finding/configuring the post-back and return URL on Opencart. I have successfully integrated the Dragonpay <strong><a href="http://www.dragonpay.ph/wp-content/uploads/2014/05/Dragonpay-PS-API.pdf" rel="nofollow">Payment Gateway API</a></strong>.</p>
  
  <p>However, I need to know the Postback and return URL's so they can configure it on their system. How do I know the postback &amp; return URL?</p>
  
  <pre><code>    public function callback() {
      if (isset($this-&gt;request-&gt;get['txnid'])) {
          $order_id = $this-&gt;request-&gt;get['txnid'];
      } else {
          $order_id = 0;
      }
      $this-&gt;load-&gt;model('checkout/order');
      $merchantid = $this-&gt;config-&gt;get('dragonpay_email');
      $ref_no = (isset($this-&gt;request-&gt;get['refno']))?$this-&gt;request-&gt;get['refno']:'';
      $status = (isset($this-&gt;request-&gt;get['status']))?$this-&gt;request-&gt;get['status']:'';
      $result = (isset($this-&gt;request-&gt;get['message']))?$this-&gt;request-&gt;get['message']:'';
      $passwd = $this-&gt;config-&gt;get('dragonpay_pwd');
      $rdigest_str = "$order_id:$ref_no:$status:$result:$passwd";
      $chk_rdigest = sha1($rdigest_str);      
      $order_info = $this-&gt;model_checkout_order-&gt;getOrder($order_id);
  
      if ($order_info &amp;&amp; isset($this-&gt;request-&gt;get['digest']) &amp;&amp; $chk_rdigest==$this-&gt;request-&gt;get['digest']) {
  
          if (isset($this-&gt;request-&gt;get['status'])&amp;&amp;strtoupper($this-&gt;request-&gt;get['status'])=="S") {
              $order_status_id = $this-&gt;config-&gt;get('config_order_status_id');
              switch(strtoupper($result)) {
                  case 'SUCESS':
                      $order_status_id = $this-&gt;config-&gt;get('dragonpay_completed_status_id');
                      break;
                  case 'FAILURE':
                      $order_status_id = $this-&gt;config-&gt;get('dragonpay_failed_status_id');
                      break;
                  case 'PENDING':
                      $order_status_id = $this-&gt;config-&gt;get('dragonpay_pending_status_id');
                      break;
  
              }
              if (!$order_info['order_status_id']) {
                  $this-&gt;model_checkout_order-&gt;confirm($order_id, $order_status_id);
              } else {
                  $this-&gt;model_checkout_order-&gt;update($order_id, $order_status_id);
              }
          } else {
              $this-&gt;model_checkout_order-&gt;confirm($order_id, $this-&gt;config-&gt;get('config_order_status_id'));
          }
      }
      $this-&gt;redirect($this-&gt;url-&gt;link('checkout/success', '', 'SSL'));
  }
  </code></pre>
  
  <p>Thanks in advance!</p>