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.
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
Hi Bikash Hutait,
ReplyDeleteThanks for your paymall php integration tutorial. Please would share a html version of paymall integration?
Thanks in advance
Willy
mcwissy@yahoo.com
Hello Willogs,
Deletehtml 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
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
ReplyDeletePlease provide me the error message.
DeleteHello Bikash,
ReplyDeleteStatus is always declined :(
Transaction Amount Maximum Exceeded (20)