Last active
          September 26, 2016 13:06 
        
      - 
      
- 
        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).
  
        
  
    
      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
    
  
  
    
  | <?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