strangerstudios / paid-memberships-pro

WordPress membership plugin to restrict access to content and charge recurring subscriptions using Stripe, PayPal, and more. Fully open source. 100% GPL.
https://www.paidmembershipspro.com
Other
462 stars 357 forks source link

Stripe can't do subs > 1 year out. Need to catch this better. #1195

Open ideadude opened 4 years ago

ideadude commented 4 years ago

Probably other gateways too.

If you create a subscription for $X every 2 years, when checking out with Stripe, you will see the confusing error "Call to a member function delete() on null"

Technically what is happening in the Stripe create_subscription call returns false. It doesn't throw an error, so we don't catch that. Then when we try to delete the plan, we get this error because the subscription doesn't exist.

We can at least catch this and show an error like "Could not create subscription."

We can also detect this when the level is setup and show a warning. We should test on other gateways (or check docs) and include them in the check as well.

Are there other combinations of subscription dates that aren't allowed? Some don't allow recurring daily subscriptions or things like that.

tictag commented 4 years ago

PayPal Express Checkout doesn't support longer than 1 year billing cycles (https://developer.paypal.com/docs/classic/express-checkout/digital-goods/ECDGRecurringPayments/?mark=create%20profile#options-for-creating-a-recurring-payments-profile)

If one is setup in PMPro, a cryptic error message is presented on the checkout page after visiting PayPal and the order never gets converted from token to success.

Interestingly, however, we have maybe 20 or so existing recurring payment subscriptions for 2 and 3 years and they are still being processed, so I guess they implemented this restriction at some point after these were originally setup.

NB This is for the old (now deprecated) Express Checkout NVP/SOAP API - not sure about the new API, branded 'PayPal Checkout'.

ryanjgillies commented 4 years ago

I've just come across this bug report from a google search and can confirm the same behaviour is still occurring between Stripe and PMPro 2.3.4

dparker1005 commented 3 years ago

We are now showing a warning when a level is set up with a billing period > 1 year and Stripe as the gateway, but we are not yet catching errors at checkout.