Last active
September 28, 2018 04:36
-
-
Save musamamasood/1c56cc5a9ef6b2da753470cc058395ca to your computer and use it in GitHub Desktop.
Method to set order status failed or completed based on Stripe 3D.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wc_gateway_stripe_process_response', 'prefix_wc_gateway_stripe_process_response', 20, 2 ); | |
function prefix_wc_gateway_stripe_process_response( $response, $order ){ | |
if($response->source->type == 'three_d_secure'){ | |
$order->update_status('completed', 'order_note'); #### | |
//WC_Stripe_Logger::log( 'wc_gateway_stripe_process_response three_d_secure response: ' . print_r( $response->source->type, true ) ); | |
}elseif($response->source->type == 'card'){ | |
$order->update_status('failed', 'order_note'); #### | |
//WC_Stripe_Logger::log( 'wc_gateway_stripe_process_response card response: ' . print_r( $response->source->type, true ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment