» Go to "Payment Modules"
The setup process for Joomla/VirtueMart modules is currently a manual process. As further versions of VirtueMart are released this may become more automated. Please note that this module is still classified as a BETA module therefore will require testing before making it LIVE. Any problems or queries with this module should be submitted to us here.
Instructions for setup is as follows:
- Unzip the contents of the VirtueMart payment module somewhere accessable.
- Copy px_paymex.php and ps_paymex.cfg.php to the joomla/administrator/components/com_virtuemart/classes/payment/ directory.
- Copy pxnotify.php to the joomla/administrator/components/com_virtuemart/ directory.
- Copy checkout.result2.php to the joomla/administrator/components/com_virtuemart/html/ directory.
- Log in to the Joomla administration panel
- Click on Components/VirtueMart
- Click "Store" on the left Administration panel
- Click "Add Payment method"
- Enter the following details:
| Option Name | Value |
| Active? | Ticked |
| Payment Method Name | Paymex |
| Code | PMX |
| Payment Class Name | ps_paymex |
| Payment method type | HTML-Form based |
- Click Save
- Click "List Payment Methods" in the menu
- Click the "Paymex" payment method in the list shown
- Click Configuration
- Enter the Paymex configuration details:
| Configuation Option | Description |
| Test Mode? | Recommended to set this to Yes until you go LIVE |
| Business Id | Set this to the business id provided to you by Paymex |
| Order Status for successful transactions | Generally set to "Confirmed" |
| Order Status for pending payments | Generally set to "Pending" |
| Order Status for failed transactions | Generally set to "Cancelled" |
- Under the Payment Extra Info section copy and paste the following code:
<?php
$db1 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country" .
" WHERE country_3_code='".$user->country."'".
" ORDER BY country_2_code ASC";
$db1->query($q);
$url = "https://secure.paymex.co.nz/Process.aspx";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$state = $dbbt->f('state');
if ($state == '-')
$state = 'n/a';
$post_variables = Array(
"business" => PAYMEX_BUSINESS,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"ex_order_id" => $db->f("order_id"),
"ex_invoice" => $db->f("order_number"),
"retail_ref" => $db->f("order_number"),
"client_ref" => $db->f("order_number"),
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"postcode" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"suburb" => $state,
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"phone" => $dbbt->f('phone_1'),
"hide_extra" => "1",
"cc_only" => "1",
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result2" .
"&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/pxnotify.php",
"notify_type" => "post",
"return_cancel" => SECUREURL ."index.php",
"test_mode" => PAYMEX_TESTMODE
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
}
else
{
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" '.
'src="https://secure.paymex.co.nz/images/btn_paynow.gif"'.
' border="0" ' .
'alt="Click here to pay securely by credit card with Paymex" />';
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>
- Click Save.
- You have now set up Paymex as a payment method for Joomla/VirtueMart
Please note that this module is still classified as a BETA module therefore will require testing before making it LIVE. Any problems or queries with this module should be submitted to us here.
Print this page
Email this page
Contact Paymex
Knowledge Base Home