Home › Forums › Stripe Payments Plugin › Subscriptions were supposed to stop after 3 payments and didn't stop
Tagged: cancel, monthly, payments, Subscription
- This topic has 19 replies, 3 voices, and was last updated 2 years, 8 months ago by Startpoint2020.
August 20, 2020 at 9:02 pm #3164
I have a subscription plan that was set up to be 3 $20 payments. First payment at the start and then 2 more $20 payments monthly after that.
Everything went well and it collected the three payments as expected. But then a month after that, it collected payment again, even though the subscription was over and should have been cancelled.
Unfortunately I did not have the debug log turned on so that is no help. (I have it turned on now for the next time the program launches).
I went directly into stripe and put all the subscriptions on an indefinite PAUSE (and refunded the incorrect payments that were taken from people).
What do I need to look at to fix this for the next time we launch?August 20, 2020 at 9:07 pm #3165
Your website must be online and accessible in order for it to be able to receive webhooks from Stripe. Also webhooks must be properly configured as well. Last, but not least – your plan must be properly configured to be “$20 monthly for 3 months”.
What values are you using for your subscription plan so we can confirm that the correct parameters are being used to make it collect only 3 payments then stop?
If all the above is correct, then debug log should have some insights on what’s wrong. Also you can check subscriptions status by going to WP Dashboard -> Stripe Payments -> Subscriptions. Click any and see if there is anything useful available on events log.August 21, 2020 at 6:37 pm #3166
Website has been online and accessible; no problem there.
Webhooks appear to be properly configured. I see green check marks for both the live and test webhooks.
The Live subscription plan has a price of $20, a billing interval of 1 month, and a duration of 3.
So I think everything is set up correctly as best as I can tell.
Unfortunately, the debug log was not on when the extra payments happened. I turned it on yesterday, but since we won’t be relaunching this program again until sometime in the fall, debug is of no help right now to know what happened in the recent past.
Now, I do see something when I go into the actual individual Subscriptions. Under “Payments Made” it says “0 of 3” and under Events, it shows the date the Subscription was created, but Amount next to that says “-” and then there are no further events after that. However, Stripe was taking the $20 at creation and every month after that.
So it seems like there is a communication issues between Stripe and the website? Is that a webhook issue? How would I fix?August 21, 2020 at 11:22 pm #3167
Subscription createdevent should be followed by
Regular payment madeevent with the amount populated. And this event is delivered by a webhook.
When Stripe can’t deliver several webhooks in a row, it sends you an email notifying about the issue. I assume you haven’t received those? Check your SPAM or JUNK email folders just in case.
Now let’s try to check if webhooks are OK. Go to here https://dashboard.stripe.com/webhooks and see if webhook URL is properly formed. It should be
example.comshould be your website URL. If it’s correct, then try to access the URL. You should see following message:
Empty Webhook data received.. This means your webhook URL is correct and it can be accessed via browser at least.August 24, 2020 at 5:36 pm #3171
We have not received any emails from Stripe about problems with webhooks (checked spam/junk too).
I checked in Stripe and the webhook URLs appear properly formed and I was able to access it via a browser and got “Empty Webhook data received”
Any other ideas why the webhook is not working with the plugin?August 24, 2020 at 5:57 pm #3172
Try to send a test webhook from Stripe Dashboard.
Make sure you have debugging enabled on Stripe Payments settings.
Go to https://dashboard.stripe.com/test/webhooks/, click on https://example.com/?asp_hook=test and click
Send test webhook...button. Select
customer.subscription.updatedfrom the dropdown and click
Send test webhook.
Then go to Stripe Payments settings page and click “View Log”. You should see similar lines at the bottom of the log:
[08/24/2020 5:53:05 PM] – [Sub] Processing “customer.subscription.updated” hook.
[08/24/2020 5:53:05 PM] – [Sub] Searching for subscription sub_00000000000000
[08/24/2020 5:53:05 PM] – [Sub] FAILURE: Subscription not found. Aborting.
Let me know if those are there.August 24, 2020 at 6:07 pm #3173
Sent the test webhook and Stripe said it was sent successfully.
Viewed the log and all I see is:
[08/20/2020 8:58:14 PM] – Stripe Payments debug log file
[08/22/2020 12:16:04 PM] – [Sub] FAILURE: Stripe Subscription Webhook sent empty data or page was accessed directly. Aborting.
8/20 was when I turned debugging on and I assume 8/22 was the other day when I viewed the webhook URL in the browser.
Nothing in the log for today (8/24).August 24, 2020 at 9:21 pm #3174
Your server might be blocking requests that look suspicious.
Check your server logs and see if POST from Stripe is not getting blocked by the server config. Here’s how the log entry looks in my Nginx server access log:
POST /?asp_hook=test HTTP/1.1″ 200 0 “-” “Stripe/1.0 (+https://stripe.com/docs/webhooks)
Also, do you have any WP security or firewall type plugins installed on your site? If yes, can you disable those and try to test the webhook again?August 25, 2020 at 3:38 pm #3180
We do have Wordfence, so I deactivated that and tested the webhook again, but still nothing showed up in the debug log.
I also checked the raw access server logs. I searched the logs for Stripe and the only hit was a GET line for a dashboard image. No POST lines for Stripe came up.
Does that mean the host (in this case, it’s Bluehost) is blocking it?
However, the log is only for the last 3 hours and doesn’t update instantly, so maybe I need to check it again in a little while to see if it recorded anything about my webhook test from this morning?
Or should I just contact Bluehost and ask them directly whether requests from Stripe are getting blocked? (Maybe you could tell me exactly what I need to ask.)August 25, 2020 at 11:31 pm #3181
I checked the server logs again a bit later and was able to see my webhook test from this morning:
POST /?asp_hook=test HTTP/1.1″ 200 1245 “-” “Stripe/1.0 (+https://stripe.com/docs/webhooks)”
So that means the server is NOT blocking, right?
And deactivating Wordfence did not help either (still nothing in debug log when I did a test webhook with Wordfence deactivated)
Any other ideas?August 27, 2020 at 5:34 am #3182AdminKeymaster
The webhook is not reaching our plugin. So something somewhere is blocking that hook so our plugin is not getting any data from Stripe (after a transaction).
Please ask you hosting if they know anything about this (or have seem something similar on any other sites on their hosting). Also, do you have any blocks in your .htaccess file? Sometimes a firewall plugin will put rules there to block incoming requests.
The log file should be updating instantly. If it is not updating instantly, then there is caching happening (you are seeing a cached version of the log file).August 27, 2020 at 11:37 am #3183
Did you see my second reply when I checked the logs again a bit later?
The Raw Access server logs on Bluehost are 2 hours old so that’s why I didn’t see anything from Stripe right away, but when I went back a couple hours later I did see POST entries for my webhook tests. So I don’t think the server is blocking anything.
I checked the htaccess file and it consists only of this:
# Added by provider
(Not sure what that is but it doesn’t seem like anything that would be causing our issue here)August 27, 2020 at 5:00 pm #3184
Try to re-create webhooks.
Go to Stripe Payments -> Settings, Subscriptions tab. Click
Delete Webhooksbutton, also click
Clear Cachebutton. Then create webhooks for both live and test modes. Then send another test webhook from Stripe Dashboard. Make sure to select
customer.subscription.updatedwebhook type. Then check logs.
If nothing in logs, we need to log in and check your site. Would be nice if you have a staging website.August 28, 2020 at 8:24 pm #3187
Okay, I think we are getting somewhere… did all that, and this is what I get in the debug log:
[08/28/2020 8:23:27 PM] – [Sub] Webhook signature successfully checked.
[08/28/2020 8:23:27 PM] – [Sub] Processing “customer.subscription.updated” hook.
[08/28/2020 8:23:27 PM] – [Sub] Searching for subscription sub_00000000000000
[08/28/2020 8:23:27 PM] – [Sub] FAILURE: Subscription not found. Aborting.
Is this good or bad?August 29, 2020 at 12:10 am #3190AdminKeymaster
That is good. It means that our plugin is now receiving the webhook correctly. The following error usually means that you have mixed up the “test mode” and “live mode” for subscription plan.
FAILURE: Subscription not found. Aborting.
Stripe doesn’t allow the subscription plans to be interchangeable between live and test mode (not like how the one time payment transaction works). So make sure that your subscription plan was created for SAME mode that you are using for the payment. For example: if you are doing test mode transactions, then make sure the subscription plan was created in “test mode”. Edit the subscription plan and check which mode you created your subscription plan. Then make sure it matches with the mode you set in the settings.
- You must be logged in to reply to this topic.