Simple Membership Plugin › Forums › Simple Membership Plugin › Fatal error! Payment with ref_id swpm_XXXX|1195 can’be found.
- This topic has 13 replies, 4 voices, and was last updated 2 years, 1 month ago by
admin.
-
AuthorPosts
-
March 29, 2024 at 3:10 pm #27851
mario
ParticipantHello Support team,
I am having this issue, as some others on the forum, but mine in particular only appears when non logged users click on the button (Stripe SCA Subscription), whenever the admin or any other subscriber tries to use the button it works fine.
On the console I have noticed that an error appears only for non logged users that is the following: Uncaught TypeError: jQuery(…).on is not a function at … and the line is this one:
jQuery(‘#swpm-stripe-payment-form-694a82263b388b51d9a16f58e110f2ab’).on(‘submit’, function(e) {e.preventDefault();
var btn = jQuery(this).find(‘button’).attr(‘disabled’, true);…I have already tried deactivating plugins and addons, installed https redirection and the custom rules on WP fastest cache. Since it works fine for logged users I suspect maybe there is some setting or something I am missing.
Thank you in advance for your help, have a nice day.
March 29, 2024 at 10:37 pm #27852The Assurer
Moderator…and the custom rules on WP fastest cache.
You means, you followed this?
WP Fastest Cache Compatibility for Simple Membership
https://simple-membership-plugin.com/wp-fastest-cache-compatibility-for-simple-membership/March 29, 2024 at 11:02 pm #27853mario
ParticipantYes, that one.
March 31, 2024 at 1:03 am #27854The Assurer
ModeratorWhat happens when you disable that caching plugin? Does it work as expected?
April 1, 2024 at 5:02 pm #27860mario
ParticipantUnfortunately it does not solve the issue. What else should I try?
April 2, 2024 at 12:48 pm #27861The Assurer
ModeratorI am having this issue, as some others on the forum, but mine in particular only appears when non logged users click on the button (Stripe SCA Subscription), whenever the admin or any other subscriber tries to use the button it works fine.
Is this button for a renewal or a new subscription?
April 5, 2024 at 2:20 pm #27880jaesga
ParticipantI 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_succeededThis 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.April 6, 2024 at 12:59 am #27882The Assurer
ModeratorThis has been referred to the developers.
April 8, 2024 at 12:36 am #27885admin
KeymasterHi, I will investigate this.
The most frequent reason for issues with Stripe subscription payment buttons often stems from an incomplete webhook configuration in your Stripe account. To ensure your webhooks are set up correctly, please consult the ‘Troubleshooting Section’ of our documentation. This section provides detailed steps to verify your webhook setup:
Can you give me info on what you have configured in the webhooks menu of your Stripe.com account (for BOTH the live and test modes)? You can find your configured webhooks by going to the following page of your Stripe account dashboard:
April 8, 2024 at 10:48 am #27887jaesga
ParticipantBoth (test / live) are configured the same way:
URL:
ENV_HOST?swpm_process_stripe_subscription=1&hook=1Events:
charge.refunded
customer.subscription.deleted
customer.subscription.updated
invoice.paid
invoice.payment_succeededLet me know if something is not properly set up
April 9, 2024 at 12:02 am #27888admin
KeymasterThank you. The webhook configuration looks fine to me.
I need to recreate this on our site so I can investigate further. I will ask some questions to get more details:
In your case, do you see the error happen before the transaction (after you click the button) or after the transaction on Stripe?
Can you post a link to the page where you have the button so I can inspect it?
If you temporarily do the following test, is there any difference?
https://simple-membership-plugin.com/forums/topic/test-for-plugin-and-theme-conflict-before-posting-an-issue-or-a-bug/Which theme are you using on this site? I will try to install the same one to test.
April 10, 2024 at 12:20 pm #27894jaesga
ParticipantThe 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,
JApril 11, 2024 at 11:22 pm #27902admin
KeymasterThank you. I will check this further and get back to you.
April 20, 2024 at 9:55 am #27929admin
KeymasterHi, Can you please share the full debug log file for the following actions (that will give me more insight into how I need to setup my test site to try to reproduce this).
1) Reset the debug log file from the settings menu of the plugin.
2) Click the Stripe subscription button and complete the test transaction.
3) After the process is complete, copy and paste the full debug log file’s details here. I will delete the text after I check it.Also, please post the URL of the page where your Stripe subscription button is so I can inspect the HTML code of it (it will be helpful for this troubleshooting).
-
AuthorPosts
- You must be logged in to reply to this topic.