WordPress Snippets at WPcustoms

Send email for EDD recurring payments

Send an email anytime a payment is recurring through EDD Easy Digital Downloads Recurring Payments


/**
 * Snippet Name: Send email for EDD recurring payments
 * Snippet URL: http://www.wpcustoms.net/snippets/send-email-edd-recurring-payments/
 */
 function pw_edd_recurring_payment_received_notice( $payment, $parent_id, $amount, $txn_id, $unique_key ) {
 
	$user_id   = edd_get_payment_user_id( $parent_id );
	$email     = edd_get_payment_user_email( $parent_id );
 
	$user_data = get_userdata( $user_id );
 
	$subject   = 'Payment Received';
	$message   = "Hello $usera_data->display_name, your payment for $amount has been received. Thanks!";
 
	wp_mail( $email, $subject, $message );
 
}
add_action( 'edd_recurring_record_payment', 'pw_edd_recurring_payment_received_notice' );