dashed-slug.net › Forums › General discussion › wallet notify › Reply To: wallet notify
November 20, 2018 at 11:11 am
#5095
alexg
Keymaster
Yes, I understand.
The question actually is not which files to modify:
You should never modify code in a plugin or theme. Whatever changes you do get overwritten on each update. Instead, use the hooks (actions and filters) provided. In this case, simply start a new plugin file, then hook into the wallets_transaction
action.
This will let you intercept all transactions that are discovered by the plugin. This way you can handle them any way you like, without having to communicate with the wallet directly. So, to intercept incoming transaction IDs for coin XYZ you’d do something like:
function handle_transactions( $txid ) {
error_log( $txid );
// handle the txid any way you like
// you would typically request the transaction data here from a wallet or block explorer
// then, maybe store the data to the db, or send an email using wp_mail()
}
add_action( 'wallets_notify_wallet_XYZ', 'handle_transactions' );
Hope this helps.
with regards