Updating WordPress table with refund hook …
-
Hello,
I am receiving email notifications successfully to my email in my 2 hooks for transactions Completed AND same transaction Refunded (testing in Sandbox).
I created a separate table and that gets updated with the transaction fine as does your IPN for wordpress.
Screen shots here: https://prntscr.com/mnxeuf and https://prntscr.com/mnxezi GREAT.I am trying to UPDATE my database when it is refunded.
Your IPN gets updated https://prntscr.com/mnxffm but my DB doesn’t, yet i get the email
sent to say ts refunded so i know I’m missing something.
I need it to update table where item_name and payer_email = data from $posted transaction.
Can you see where I’ve gone wrong please?
Here’s the code:<?php //--> REFUND HOOK add_action('paypal_ipn_for_wordpress_payment_status_refunded', 'refunded_send_email', 10, 1); function refunded_send_email($posted) // email part i left out for this post as it works.. { global $wpdb; $table_name = $wpdb->prefix . "ipn_data_tbl"; $payment_status = isset($posted['payment_status']) ? $posted['payment_status'] : ''; $receiver_email = isset($posted['receiver_email']) ? $posted['receiver_email'] : ''; $payer_email = isset($posted['payer_email']) ? $posted['payer_email'] : ''; $item_name = isset($posted['item_name']) ? $posted['item_name'] : ''; $first_name = isset($posted['first_name']) ? $posted['first_name'] : ''; $last_name = isset($posted['last_name']) ? $posted['last_name'] : ''; $wpdb->update( $ipn_table, array( 'payment_status' => $payment_status ), array( 'payer_email' => $serial, 'item_name' => $product, )); } //<---REFUND HOOK ?>
Hope code is ok above to read..else here-> https://prntscr.com/mnxgla
thx,
Rob
- The topic ‘Updating WordPress table with refund hook …’ is closed to new replies.