Home Communication board WiKi Get Quote

How to skip PayPal express checkout confirmation step in the X-Cart?

The additional step for the express checkout is implemented in the X-Cart checkout process. The customer should confirm the order here. In most of the cases it's better to skip it in the following way.

You should open the payment/ps_paypal_pro_us.php (or payment/ps_paypal_pro_uk.php if you use the UK solution) in an editor and find the following line:

func_header_location($xcart_catalogs['customer'].'/cart.php?paymentid='.$paypal_payment_id.'&mode=checkout');

This line should be replaced with the following ones:

        require_once $xcart_dir."/include/payment_wait.php";

        $fields = array(
        'paymentid' => $paypal_payment_id,
        'action' => 'place_order',
        'Customer_Notes' => $paypal_customer_notes,
        'xid' => $XCARTSESSID,
        'payment_method' => func_query_first_cell("select payment_method from $sql_tbl[payment_methods] where paymentid='$paypal_payment_id'"),
        );
	    func_create_payment_form($current_location.'/payment/payment_cc.php', $fields, "PayPal");
        die();

With this code you are emulating the customer confirmation. The appropriate form is created and submitted automatically.

Also the paymentid should be stored to the cart in the payment/payment_cc.php. Please insert:

$cart['paymentid'] = $paymentid;

after

if(empty($secure_oid) || ($secure_oid_cost != $cart["total_cost"])) {

You will receive something like:

if(empty($secure_oid) || ($secure_oid_cost != $cart["total_cost"])) {
    $cart['paymentid'] = $paymentid;
    $orderids = func_place_order(stripslashes($payment_method)." (".$module_params["module_name"].(get_cc_in_testmode($module_params)?", in test mode":"").")", "I", $order_details, $customer_notes);
 
Home About us Privacy statement Terms & Conditions Refund policy © 2007–2021 ArsCommunity