wpsc_submit_checkout

Located in: ajax.functions.php

Functions that call this hook: wpsc_submit_checkout()
Arguments Accepted: array( “purchase_log_id” => $purchase_log_id, “our_user_id” => $our_user_id )
Version Introduced: 3.8

Description: This hook is called after all the data is validated and collated from the checkout (and logged int he database) but before the payment gateway is called. The order ID, and user ID are included as parameters.

Code in context:
[php firstline=”627″ highlight=”656″]
$total = $wpsc_cart->calculate_total_price();
$wpdb->insert( WPSC_TABLE_PURCHASE_LOGS, array(
‘totalprice’ => $total,
‘statusno’ => ‘0’,
‘sessionid’ => $sessionid,
‘user_ID’ => (int)$user_ID,
‘date’ => strtotime( current_time( ‘mysql’ ) ),
‘gateway’ => $submitted_gateway,
‘billing_country’ => $wpsc_cart->selected_country,
‘shipping_country’ => $delivery_country,
‘billing_region’ => $wpsc_cart->selected_region,
‘shipping_region’ => $delivery_region,
‘base_shipping’ => $base_shipping,
‘shipping_method’ => $shipping_method,
‘shipping_option’ => $shipping_option,
‘plugin_version’ => WPSC_VERSION,
‘discount_value’ => $wpsc_cart->coupons_amount,
‘discount_data’ => $wpsc_cart->coupons_name,
‘find_us’ => $find_us,
‘wpec_taxes_total’ => $tax,
‘wpec_taxes_rate’ => $tax_percentage
) );
$purchase_log_id = $wpdb->insert_id;
$wpsc_checkout->save_forms_to_db( $purchase_log_id );
$wpsc_cart->save_to_db( $purchase_log_id );
$wpsc_cart->submit_stock_claims( $purchase_log_id );
if( !isset( $our_user_id ) && isset( $user_ID ))
$our_user_id = $user_ID;
$wpsc_cart->log_id = $purchase_log_id;
do_action( ‘wpsc_submit_checkout’, array( "purchase_log_id" => $purchase_log_id, "our_user_id" => $our_user_id ) );
if ( get_option( ‘permalink_structure’ ) != ” )
$separator = "?";
else
$separator = "&";

// submit to gateway
if ( wpsc_is_payment_gateway_registered( $submitted_gateway ) ) {
$gateway = wpsc_get_payment_gateway( $submitted_gateway );
$gateway->set_purchase_log( new WPSC_Purchase_Log( $purchase_log_id ) );
$gateway->process();
} else {
$current_gateway_data = &$wpsc_gateways[$submitted_gateway];

[/php]