Skip to content

Instantly share code, notes, and snippets.

@vanbo
Last active September 9, 2021 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/5bddccb7eb92b594ea0ec0ce63ac329f to your computer and use it in GitHub Desktop.
Save vanbo/5bddccb7eb92b594ea0ec0ce63ac329f to your computer and use it in GitHub Desktop.
WC Paysafe: Add transaction amount to the order notes
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