title: Mercury payment system
body: <p>I am trying to use a mercury payment system sending a API request and in return I am getting a payment id.
  According to their documentation, after getting the payment id we have to send it as a post to their payment process host <a href="https://hc.mercurydev.net/CheckoutPOS.aspx" rel="nofollow">https://hc.mercurydev.net/CheckoutPOS.aspx</a>
  I am getting redirected to the page the amount is not showing properly.
  Any suggestions?</p>
  
  <p>Following is the request API</p>
  
  <pre><code>function get_ms_payment_id($ms_merchant_id,$ms_password,$order_header_id,$amount,$tax,$success_url,$failure_url)
  {
      $soap_request = '&lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"&gt;';
      $soap_request .= '&lt;SOAP-ENV:Body&gt;';
      $soap_request .= '&lt;InitializePayment xmlns="http://www.mercurypay.com/"&gt;';
      $soap_request .= '&lt;request&gt; ';
      $soap_request .= '&lt;MerchantID&gt;'.$ms_merchant_id.'&lt;/MerchantID&gt; ';
      $soap_request .= '&lt;Password&gt;'.$ms_password.'&lt;/Password&gt; ';
      $soap_request .= '&lt;Invoice&gt;'.$order_header_id.'&lt;/Invoice&gt; ';
      $soap_request .= '&lt;TotalAmount&gt;50.23&lt;/TotalAmount&gt;';
      $soap_request .= '&lt;TaxAmount&gt;'.$tax.'&lt;/TaxAmount&gt;';
      $soap_request .= '&lt;TranType&gt;Sale&lt;/TranType&gt; ';
      $soap_request .= '&lt;Frequency&gt;OneTime&lt;/Frequency&gt;';
      $soap_request .= '&lt;Memo&gt;Your Memo&lt;/Memo&gt; ';
      $soap_request .= '&lt;PartialAuth&gt;Off&lt;/PartialAuth&gt; ';
      $soap_request .= '&lt;ProcessCompleteUrl&gt;'.$success_url.'&lt;/ProcessCompleteUrl&gt; ';
      $soap_request .= '&lt;ReturnUrl&gt;'.$failure_url.'&lt;/ReturnUrl&gt; ';
      $soap_request .= '&lt;DisplayStyle&gt;Custom&lt;/DisplayStyle&gt;';
      $soap_request .= '&lt;BackgroundColor&gt;Gray&lt;/BackgroundColor&gt;';
      $soap_request .= '&lt;FontColor&gt;Black&lt;/FontColor&gt;';
      $soap_request .= '&lt;FontFamily&gt;FontFamily1&lt;/FontFamily&gt;';
      $soap_request .= '&lt;FontSize&gt;Medium&lt;/FontSize&gt;';
      $soap_request .= '&lt;PageTitle&gt;Demo Ecommerce Merchant&lt;/PageTitle&gt;';
      $soap_request .= '&lt;SecurityLogo&gt;on&lt;/SecurityLogo&gt;';
      $soap_request .= '&lt;OrderTotal&gt;on&lt;/OrderTotal&gt;';
      $soap_request .= '&lt;SubmitButtonText&gt;Submit&lt;/SubmitButtonText&gt;';
      $soap_request .= '&lt;CancelButtonText&gt;Cancel&lt;/CancelButtonText&gt;';
      $soap_request .= '&lt;/request&gt; ';
      $soap_request .= '&lt;/InitializePayment&gt;';
      $soap_request .= '&lt;/SOAP-ENV:Body&gt;';
      $soap_request .= '&lt;/SOAP-ENV:Envelope&gt;';
  
      $header = array("POST /ws/ws.asmx HTTP/1.1", 
          "Host: w1.mercurypay.com", 
          "Content-Type: text/xml; charset=utf-8",
          "SOAPAction: \"http://www.mercurypay.com/InitializePayment\"");
  
      $url = "https://hc.mercurydev.net/hcws/hcservice.asmx";
  
      $ch = curl_init();
  
      curl_setopt($ch, CURLOPT_URL,$url);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_TIMEOUT, 4);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $soap_request);
  
      $result = curl_exec($ch);
  
      include_once('xml.php');
      $x_data = XML_unserialize($result);
  
      $x_data = $x_data["soap:Envelope"];
      $x_data = $x_data["soap:Body"];
      $x_data = $x_data["InitializePaymentResponse"];
      $result = $x_data["InitializePaymentResult"];
  
      return($result);
  }
  </code></pre>
  
  <p>in response I am getting a valid paymentId, After using the paymentId I posting it to payment gateway
  but the proper amount is not populating on payment gateway.</p>
  
  <p>Following is the screenshot of the payment gateway</p>
  
  <p><a href="http://screencast.com/t/FbULkAy01X0L" rel="nofollow">http://screencast.com/t/FbULkAy01X0L</a></p>
  
  <p>Thank you</p>