• Resolved nef426

    (@nef426)


    Hi,

    I’m setting up a store using the latest versions of wordpress (3.2.1) and goldcart 2.9.2.

    If a card is accepted, everything works fine, but if the transaction is declined by bluepay, wp e-commerce doesnt give any message, and redirects to the website’s home page.

    Anyone have any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, I had the same problem when I built a gateway for a customer, the solution might not be the exact solution for you, but it should be a good place to start.

    In my gateway where it checks the gateway response I had the following mistake

    if ( is_array( $result ) && $result['vpc_TxnResponseCode'] == 0 ) {
    
    		//redirect to  transaction page and store in DB as a order with
    		//accepted payment
    
    		$sql = "UPDATE
    
    " . WPSC_TABLE_PURCHASE_LOGS .
    		"SET processed = '2', notes = '" . serialize( $result ) . "'
    		WHERE sessionid = " . $sessionid;
    
    		$wpdb->query( $sql );
    
    		$transact_url = get_option( 'transact_url' );
    
    		unset( $_SESSION['WpscGatewayErrorMessage'] );
    
    		header( "Location: " . $transact_url . $seperator . "sessionid=" . $sessionid );
    
    	}
    	else{
    
    		//redirect back to checkout page with errors
    		$sql = "UPDATE " . WPSC_TABLE_PURCHASE_LOGS .
    		" SET processed = '5', notes  = '" . serialize( $result ) . "'
    		WHERE sessionid = " . $sessionid;
    
    		$wpdb->query( $sql );
                    // Problem is below, there is no 'checkout_url' option, so transact_url is not being set properly
    		$transact_url = get_option( 'checkout_url' );
    		$_SESSION['WpscGatewayErrorMessage'] = __( 'Sorry your transaction did not go through successfully, please try again.' );// . '<br />Gateway Response: ' . getResponseCodeDescription( $result['vpc_TxnResponseCode'] );
    
    		header( "Location: " . $transact_url );
    
    	}

    Notice I was just mistakenly pointing them to a URL that wasn’t defined anywhere, and thus they were ending up back at the home page. Took me a while to figure it out.

    The correct redirect URL code for failed transaction should be;

    $transact_url = get_option( 'transact_url' );

    Not sure how I managed to get it mixed up. You may also want to check in your database that the option ‘transact_url’ has the correct value (should be something like https://www.yoursite.com/store/checkout/).

    Thread Starter nef426

    (@nef426)

    kounterfeit,

    THANK YOU.
    I just went into the bluepay.php file and sure enough on line 163, there was that error:

    $transact_url = get_option( 'checkout_url' );
    in place of:
    $transact_url = get_option( 'transact_url' );

    Declined cards now redirect correctly to the the transaction results page.

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bluepay Declined transaction forwards to home page’ is closed to new replies.