Created
September 22, 2021 12:09
-
-
Save vanbo/26554817bfdb6eb48df25f5c56ada71a to your computer and use it in GitHub Desktop.
Paysafe JSON API: modify MerchantRefNumber
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
/** | |
* IMPORTANT: Add to your 'wp-content/themes/theme-name/functions.php' file | |
*/ | |
add_filter( 'wc_paysafe_token_transaction_parameters', 'vanbodevelops_paysafe_modify_merchant_ref_number', 10, 4 ); | |
/** | |
* @param array $params The request parameters | |
* @param \WC_Order $order The WC order object | |
* @param string $token The payment token | |
* @param string $trans_type The transaction type: 'cards', 'directdebit' | |
* | |
* @return array | |
*/ | |
function vanbodevelops_paysafe_modify_merchant_ref_number( $params, $order, $token, $trans_type ) { | |
// Add any value you want to the reference number | |
$params['merchantRefNum'] = 'add-the-value-as-prefix-' . $params['merchantRefNum'] . '-or-add-the-value-as-suffix'; | |
return $params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment