Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save greenhornet79/587cce215eee73db07f22b96ad5d2bfb to your computer and use it in GitHub Desktop.
Save greenhornet79/587cce215eee73db07f22b96ad5d2bfb to your computer and use it in GitHub Desktop.
<?php
// Send an email to the subscriber when Authorize.net sends a net.authorize.customer.subscription.expired webhook event
// Notice the action is the event name, with the periods changed out for underscores
// Any event can be accessed that way
add_action('leaky_paywall_net_authorize_customer_subscription_expired', 'zeen_send_expired_notice', 10, 2);
function zeen_send_expired_notice($user, $webhook_data)
{
$to = $user->user_email;
$subject = 'Your subscription has expired';
$body = 'Your subscription has expired. Please renew here: https://example.com';
$headers = array('Content-Type: text/html; charset=UTF-8', 'From: My Site Name <support@example.com');
wp_mail($to, $subject, $body, $headers);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment