Guest User

Untitled

a guest
Jun 7th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. function pw_edd_update_payment_status($payment_id) {
  2.  
  3.     // Basic payment meta
  4.     $payment_meta = edd_get_payment_meta($payment_id );
  5.     $user_id =  $payment_meta['user_info']['id'];
  6.     $uuid = get_user_device_token($user_id);
  7.     $payment = new EDD_Payment( $payment_id );
  8.     $message = 'Status updated to: '.$payment->status;
  9.     sendPushNotification($uuid, $message);
  10.  
  11. }
  12. //This action runs when a payment status is changed
  13. add_action( 'edd_update_payment_status', 'pw_edd_update_payment_status' );
  14.  
  15.  
  16. function pw_edd_on_complete_purchase( $payment_id ) {
  17.  
  18.     // Basic payment meta
  19.     $payment_meta = edd_get_payment_meta($payment_id );
  20.     $user_id =  $payment_meta['user_info']['id'];
  21.     // $uuid = get_user_device_token($user_id);
  22.     $message = 'Purchased completed';
  23.     // sendPushNotification($uuid, $message);
  24.  
  25.    // error_log( $payment_meta );
  26.  
  27. }
  28.  
  29. //This action runs when a payment is marked as complete.
  30. add_action( 'edd_complete_purchase', 'pw_edd_on_complete_purchase' );
Add Comment
Please, Sign In to add comment