Skip to content

Commit

Permalink
Add support for renewal failures
Browse files Browse the repository at this point in the history
* ENHANCEMENT: Added support for renewal failure events. This will trigger when a subscription charge fails to process and will remove the members level for this event type.
  • Loading branch information
andrewlimaza committed May 20, 2024
1 parent 755c641 commit 14b47f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@

break;

case 'RenewalFailure':

$subscription_id = sanitize_text_field( $response['subscriptionId'] );

$morder = new MemberOrder();
$morder->getLastMemberOrderBySubscriptionTransactionID( $subscription_id );
$morder->getMembershipLevel();
$morder->getUser();

if(pmpro_ccbill_RecurringCancel($morder))
pmpro_ccbill_Exit();
break;

default:
do_action('pmpro_ccbill_other_webhook_events', $event_type);
pmpro_ccbill_Exit();
Expand Down

0 comments on commit 14b47f8

Please sign in to comment.