X-Cart:Payment methods not working in X-Cart 4.1.x

From X-Cart 4 Classic
Revision as of 13:19, 23 May 2016 by Dohtur (talk | contribs) (Created page with "After upgrading to PHP 5.4 or later, users of X-Cart 4.1.x may experience a problem with their payment methods: after a buyer goes to complete their payment on the payment pro...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

After upgrading to PHP 5.4 or later, users of X-Cart 4.1.x may experience a problem with their payment methods: after a buyer goes to complete their payment on the payment processor end, they are either not returned to the X-Cart store, or the order status in X-Cart remains "Not Finished" (not updated to "Processed") due to payment callback failure. (Note that X-Cart 4.2.x and later versions are not affected by this problem).

To fix the problem, you will need to add the following code snippet:

if (empty($HTTP_SERVER_VARS)) {
   $HTTP_SERVER_VARS = (array)$_SERVER;
   $HTTP_GET_VARS = (array)$_GET;
   $HTTP_POST_VARS = (array)$_POST;
   $HTTP_COOKIE_VARS = (array)$_COOKIE;
   $HTTP_POST_FILES = (array)$_FILES;
   $HTTP_ENV_VARS = (array)$_ENV;
}

to the beginning of payment method file for every payment method you will be using. For instance, for "PayPal Standard" you will need to add the above code snippet to payment/ps_paypal.php, for "AuthorizeNet - SIM" - to payment/cc_authorizenet_sim.php.