Located in: merchant.class.php, payment-gateway.class.php

Functions that call this hook: go_to_transaction_results()
Arguments Accepted: none
Version Introduced: 3.8

Description: This hook is triggered after the customer has made a successful payment and returned from the gateway, and just before they are redirected to the transaction results page.

You would use this hook to preform extra tasks relating to successful payments that WP-e-Commerce doesn’t handle for you.

Similar Hooks: wpsc_payment_failed – triggered on failed transactions, wpsc_payment_incomplete – something went wrong or the customer left the store and decided not to pay.

Code in context:
[php firstline=”272″ highlight=”283″]
* go_to_transaction_results, please don’t extend this without very good reason
* go to transaction results, if this changes and you extend this, your merchant module may go to the wrong place
function go_to_transaction_results( $session_id ) {
global $wpdb, $purchase_log;

//Now to do actions once the payment has been attempted
switch ($purchase_log[‘processed’]) {
case 3:
// payment worked
case 1:
// payment declined
case 2:
// something happened with the payment

$transaction_url_with_sessionid = add_query_arg( ‘sessionid’, $session_id, get_option( ‘transact_url’ ) );
wp_redirect( $transaction_url_with_sessionid );

exit(); // follow the redirect with an exit, just to be sure.