Last active
September 9, 2021 12:47
-
-
Save vanbo/5bddccb7eb92b594ea0ec0ce63ac329f to your computer and use it in GitHub Desktop.
WC Paysafe: Add transaction amount to the order notes
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_paysafe_payment_response_processed', 'vanbodevelops_paysafe_add_order_details_after_payment', 10, 2 ); | |
/** | |
* IMPORTANT: Add the code to your 'child-theme/functions.php' file | |
* | |
* @param \WC_Order $order | |
* @param \WcPaysafe\Api\Response_Abstract $response | |
*/ | |
function vanbodevelops_paysafe_add_order_details_after_payment($order, $response) { | |
// If the transaction is successful | |
if ( 'completed' == strtolower( $response->get_status() ) ) { | |
// The amount of the response, | |
$amount = wc_format_decimal( $response->get_amount() / 100 ); | |
$order->add_order_note('Paysafe: Transaction Amount: '. $amount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment