ionos

Wednesday, December 11, 2013

Paymall Payment Gateway Integration


Paymall Payment Gateway(Code)

How to integrate PAYMALL?

Steps:

  • Create the HTML form:
  • Integrate the HTML form with below PHP code.It will working fine.


Amount:
Currency:

Card Details


Name On Card:
Card Number:
CardExpiration Date:
Card Validation Value:

Billing Info Details


First Name:


Last Name:

Address Line1:

Address Line2:

City:

State:

Country:

Postal Code:


PHP Code:

Note:-isset($_POST['paymall'])//////Here "paymall" is submit button name

if(isset($_POST['paymall'])) {

function do_post_request($url, $data, $optional_headers = null){
$params = array('http' => array('method' => 'POST','content' => http_build_query($data),));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers; }
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg"); }
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");}
parse_str($response, $output); return $output;}

The mp_IsTestTrans value must be changed to 'False' when the mp_AuthenticationID/mp_AuthenticationPassword test account values are replaced with values for a live account

$postdata = array(
'mp_APIVersion' => '2.0',
'mp_IsTestTrans' => 'False', Live account
'mp_AuthenticationID' => 'xxxxxxx' , Enter your AuthenticationID
'mp_AuthenticationPassword' => 'xxxxxxx', Enter your AuthenticationPassword
'mp_ConfigID' => '1',
'mp_MessageRequestType' => 'Sale',
'mp_TransClearingAction' => 'Capture',
'mp_IsCardPresent' => 'False',
'mp_PaymentMethod' => 'CreditCard',
'mp_CardNumber' => $_REQUEST['mp_CardNumber'],
'mp_NameOnCard' => $_REQUEST['mp_NameOnCard'],
'mp_CardExpirationDate' => $_REQUEST['mp_CardExpirationDate'],
'mp_CardValidationValue' => $_REQUEST['mp_CardValidationValue'],
'mp_TotalAmount' => $_REQUEST['mp_TotalAmount'],
'mp_CurrencyCode' => 'USD',
'mp_OrderNumber' => '5678',
'mp_BillingFirstName' => $_REQUEST['mp_BillingFirstName'],
'mp_BillingLastName' => $_REQUEST['mp_BillingLastName'],
'mp_BillingAddressLine1' => $_REQUEST['mp_BillingAddressLine1'],
'mp_BillingCity' => $_REQUEST['mp_BillingCity'],
'mp_BillingState' => $_REQUEST['mp_BillingState'],
'mp_BillingPostalCode' => $_REQUEST['mp_BillingPostalCode'],
'mp_BillingCountryCode' => $_REQUEST['mp_BillingCountryCode'],
'mp_CustomerIPAddress' => $_SERVER['REMOTE_ADDR'],
);
$result = do_post_request('https://gateway.mtrex.com/omega.mp',$postdata);
echo "Customer Name:".$_REQUEST['mp_BillingFirstName']."".$_REQUEST['mp_BillingLastName'];
echo "
";
echo "Your Transaction ID:".$result['mp_TransID']."\n";
echo "
";
echo "Transaction Result:".$result['mp_TransResult']."\n";
echo "
";
echo "Transaction Result:".$result['mp_TransResultMessage']."\n";
echo "
";
}
?> End Here

5 comments:

  1. Hi Bikash Hutait,

    Thanks for your paymall php integration tutorial. Please would share a html version of paymall integration?
    Thanks in advance
    Willy
    mcwissy@yahoo.com

    ReplyDelete
    Replies
    1. Hello Willogs,

      html version of paymall integration is not secure. The shopper can just change the price of the product by viewing the HTML source and changing the mp_TotalAmount parameter. Also they can see your password.

      Instead of having the web browser do a form post to the gateway, you need to do a background post programmatically using a programming language such as PHP or C#.

      Thanks,
      Bikash Hutait
      bikash.hutait03@gmail.com

      Delete
  2. pls let me know the php code for this i have made the form and entered the live a/c details but still its showing me error

    ReplyDelete
  3. Hello Bikash,

    Status is always declined :(

    Transaction Amount Maximum Exceeded (20)

    ReplyDelete

Featured Post

Payza integration

Payza's Advanced Button in HTML Using simple HTML, you can integrate easily with Payza.Generate buttons and manage payment details f...

Most Popular