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
You are here: Home

jaesga

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 10, 2024 at 12:20 pm in reply to: Fatal error! Payment with ref_id swpm_XXXX|1195 can’be found. #27894
    jaesga
    Participant

    The error happends while executing the callback function (SwpmStripeSCASubscriptionIpnHandler::handle_stripe_ipn).

    After paying on stripe everything seems fine, then when redirected to my site executing that function leads to the error. Searching into the code I’m pretty sure the problem is a race condition.

    When reaching swpm-stripe-sca-subscription-ipn.php:L69 $sess is false, because $events array (L50) is empty.

    Activating my logs, I see that this error (Fatal error! Payment with ref_id %s can’t be found) is logged before the webhook notification logs for events invoice.paid and invoice.payment_succeeded (check my first messsage).

    I fixed on my site by adding some retries with 1s sleep in between to fetch the “checkout.session.completed” events from Stripe and after 1-2s the event is ready and things starts working again.

    Hope this helps you to reproduce / patch.
    Regards,
    J

    April 8, 2024 at 10:48 am in reply to: Fatal error! Payment with ref_id swpm_XXXX|1195 can’be found. #27887
    jaesga
    Participant

    Both (test / live) are configured the same way:

    URL:
    ENV_HOST?swpm_process_stripe_subscription=1&hook=1

    Events:
    charge.refunded
    customer.subscription.deleted
    customer.subscription.updated
    invoice.paid
    invoice.payment_succeeded

    Let me know if something is not properly set up

    April 5, 2024 at 2:20 pm in reply to: Fatal error! Payment with ref_id swpm_XXXX|1195 can’be found. #27880
    jaesga
    Participant

    I am having exactly the same problem since few days ago.

    I think the problem is on a race condition under SwpmStripeSCASubscriptionIpnHandler::handle_stripe_ipn.
    I realized that the callback to my site (and that method execution) was perform before these Webhook events are received:

    [2024/04/05 16:12:31] – SUCCESS: End of Stripe subscription webhook processing. Webhook type: invoice.paid
    [2024/04/05 16:12:32] – SUCCESS: Stripe subscription webhook received: invoice.payment_succeeded. Checking if we need to handle this webhook.
    [2024/04/05 16:12:32] – SUCCESS: End of Stripe subscription webhook processing. Webhook type: invoice.payment_succeeded

    This probably make “checkout.session.completed” event still not available causing the error.
    I added for testing purposes just a sleep(2) to the code and things start to work again.

    Can some developer of the plugin check this out plz? Maybe a recent update of the plugin break something? I will try to review the changelog.

    Thanks in advance,
    J.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
Next Page »

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