Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: Paymex payments NZ  (Read 669 times)
kahungunu
Newbie
*
Posts: 2


« on: June 12, 2011, 19:18:21 PM »

Hi, can anyone help me with integrating the paymex payment method?

Everything works fine until I get pointed back to the website after Paymex has processed the payment. The message displayed is confirming the transaction was successful and payment was transferred however the order status is still set to pending so no confirmation email is sent.

Any help is appreciated.
Logged
VM_Fans
Full Member
***
Posts: 100


« Reply #1 on: June 13, 2011, 06:41:36 AM »

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:

   1. Unzip the contents of the VirtueMart payment module somewhere accessable.
   2. Copy px_paymex.php and ps_paymex.cfg.php to the joomla/administrator/components/com_virtuemart/classes/payment/ directory.
   3. Copy pxnotify.php to the joomla/administrator/components/com_virtuemart/ directory.
   4. Copy checkout.result2.php to the joomla/administrator/components/com_virtuemart/html/ directory.
   5. Log in to the Joomla administration panel
   6. Click on Components/VirtueMart
   7. Click "Store" on the left Administration panel
   8. Click "Add Payment method"
   9. 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
  10. Click Save
  11. Click "List Payment Methods" in the menu
  12. Click the "Paymex" payment method in the list shown
  13. Click Configuration
  14. 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"
  15. 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>';

      }
      ?>

  16. Click Save.
  17. You have now set up Paymex as a payment method for Joomla/VirtueMart
Logged

kahungunu
Newbie
*
Posts: 2


« Reply #2 on: June 13, 2011, 20:43:21 PM »

Hi VM_Fans, thanks for your reply.

I have set up the paymex module as per the instructions on the paymex site and the ones above. The issue is once I get pointed back to the website, once the payment process has been completed on the paymex site, the order status is still at pending.
Logged
Pages: [1]   Go Up
Print
Jump to: