Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] BILLING.SUBSCRIPTION.PAYMENT.FAILED is subscribed but never handled

Simple Membership Plugin › Forums › Simple Membership Plugin › BILLING.SUBSCRIPTION.PAYMENT.FAILED is subscribed but never handled

  • This topic has 1 reply, 2 voices, and was last updated 1 month ago by admin.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 16, 2026 at 10:43 am #32381
    freetiermorioka555
    Participant

    ## Summary

    The plugin subscribes to the PayPal webhook event BILLING.SUBSCRIPTION.PAYMENT.FAILED, but the webhook handler has no code path for it. As a result, a failed subscription payment is never reflected on the site, and members on “No Expiry” levels keep paid access indefinitely unless a cancel or suspend event arrives.

    ## Environment

    – Plugin: Simple Membership
    – Versions checked: 4.4.3 (in production) and 4.7.2 (source reviewed; the same code is present)
    – Gateway: PayPal, PPCP subscriptions (button type pp_subscription_new), REST webhooks

    ## What happens

    1. get_event_types() includes BILLING.SUBSCRIPTION.PAYMENT.FAILED in the list of webhook events the plugin registers.
    2. In handle_paypal_webhook(), the switch ( $event_type ) has no case for this event. It falls through to default: break; and nothing is done.
    3. So when PayPal fails to collect a recurring payment, the site is never told in any usable way.
    4. The member stays on the paid level. If the membership level’s subscription_duration_type is “No Expiry”, SwpmCronJob::update_account_status() cannot expire the account either, because SwpmUtils::get_expiration_timestamp() returns PHP_INT_MAX for such levels.
    5. In practice, unless a cancel or suspend webhook eventually arrives, there is no mechanism that ends access.

    A related point: handle_subscription_status_update() uses the last_webhook_status value in the member’s extra info to avoid processing the same status twice. I could not find any code in the plugin that clears this value. If a member cancels, re-subscribes, and later a second event of the same kind arrives, it appears to be treated as already processed and ignored. I may be missing something, but I did not find a reset path.

    ## Where in the code (line numbers are for 4.7.2)

    – lib/paypal/class-swpm-paypal-webhook.php, get_event_types() — the event is listed at line 287.
    – lib/paypal/class-swpm-paypal-webhook-event-handler.php, handle_paypal_webhook() — the switch ( $event_type ) has no matching case.
    – lib/paypal/class-swpm-paypal-webhook-event-handler.php, handle_subscription_status_update() — reads and writes last_webhook_status.
    – SwpmCronJob::update_account_status() and SwpmUtils::get_expiration_timestamp() — No Expiry handling.

    ## Why this matters

    Site owners can end up giving paid access to members whose payments are failing, with no signal on the WordPress side. Since the event is already subscribed to, this looks more like an unintended gap than a design decision.

    ## Suggested fix

    – Add a case for BILLING.SUBSCRIPTION.PAYMENT.FAILED in handle_paypal_webhook().
    – Because immediate cancellation is not always desirable (a temporary card error often recovers within a few days), it would be helpful to provide a filter or action hook so each site can decide the policy, for example based on the number of consecutive failures or the days since the last successful payment.
    – Clear last_webhook_status when a payment succeeds (PAYMENT.SALE.COMPLETED), so later status events are not wrongly skipped.
    – A few other subscribed events also appear to be unhandled: BILLING.SUBSCRIPTION.CREATED, BILLING.SUBSCRIPTION.UPDATED, PAYMENT.SALE.REVERSED, and PAYMENT.CAPTURE.REVERSED. If that is intentional, no problem. For PAYMENT.FAILED, it looks like an oversight.

    Happy to share sanitized log excerpts if useful. Thank you for maintaining the plugin, and I would be glad to help test a fix.

    October 17, 2026 at 6:48 am #32387
    admin
    Keymaster

    Thank you. I will apply a fix for this. It will go out with the next release.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy