dashed-slug.net › Forums › General discussion › New TX hook › Reply To: New TX hook
January 1, 2019 at 3:03 pm
#5430
Keymaster
Hello and happy new year,
You can get notified about transaction data by binding to the wallets_transaction
action. For example you could add this to your child theme’s functions.php
file, or in a new plugin:
function wallets_transaction_cb( $tx ) {
error_log( print_r( $tx, true ) ); // prints out a stdClass object
}
add_action( 'wallets_transaction', 'wallets_transaction_cb' );
You will get multiple notifications for each transaction, because the confirmations number is updated each time.
It is your responsibility to handle each transaction only once, so you would have to somehow keep a record of already seen TXIDs. Alternatively, you could perform your action only when the confirmation count is equal to some integer value.
Hope this helps. Please let me know if you have any further questions.
with regards