Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active September 26, 2016 13:06
Show Gist options
  • Save max-kk/b2ca9a193a2afd4043d359bb273fe34d to your computer and use it in GitHub Desktop.
Save max-kk/b2ca9a193a2afd4043d359bb273fe34d to your computer and use it in GitHub Desktop.
How to save Paypal "receiver_email" on Paypal Standart payments (if you want see later to what emails payment was send).
<?php
/**
* Lets save Paypal "receiver_email"
*/
add_action( 'edd_paypal_web_accept', 'my001_edd_process_paypal_web_accept_and_cart', 11, 2 );
function my001_edd_process_paypal_web_accept_and_cart( $data, $payment_id )
{
if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
return;
}
if (empty($payment_id)) {
return;
}
$payment_status = strtolower( $data['payment_status'] );
$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
if ( 'completed' == $payment_status ) {
edd_insert_payment_note( $payment_id, sprintf('PayPal business_email/receiver_email: %s', $business_email) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment