jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Earn blocks: "Sales disabled" notice after reconnecting to Stripe

Open mmtr opened this issue 6 years ago • 160 comments

When a user disconnects their Stripe account in wordpress.com/earn/payments, all plans are invalidated by setting a 'account_disconnected' => true flag in all of them (see A8C\Billingdaddy\Api\Connected_Accounts::disconnect_connected_account in the WP.com codebase).

That ensures that any existing Earn block (Payments, Premium Content, Donations) don't go through the checkout process if a user tries to submit a payment. Instead we display a "Sales disabled" notice:

Screen Shot 2020-08-26 at 14 18 26

However, if that user decides to reconnect their Stripe account, the account_disconnected flag is not removed from the plans, so all Earn blocks previously published continue displaying the "Sales disabled" notice.

This can be worked around for the Payments and Premium Content blocks, since a user can delete the old plan and create a new one that won't have the account_disconnected flag. But for the Donations block this is rather problematic, since a user cannot manage donation-type plans, so Donations blocks published after the reconnection won't work either.

mmtr avatar Aug 26 '20 12:08 mmtr

cc @artpi in case he has any advice

mmtr avatar Aug 26 '20 12:08 mmtr

Ok, this is weird. I cannot longer reproduce this, so I guess I was a problem on my sandbox (maybe I wasn't sandboxing everything correctly).

mmtr avatar Aug 27 '20 10:08 mmtr

Reopening this since @blackjackkent started experiencing it too. To be honest, all the code I investigated seems correct, so I think the issue is only happening when there is some sandbox misconfiguration and likely is not going to affect final users.

But if we want to avoid this, one way is by completely removing the plan IDs from the Donations block attributes. Given that plans are automatically set/created without the user noticing it, we can actually do that as part or the dynamic block rendering.

That would mean that plan IDs won't be fetched as part of the block edit logic, instead we can fetch them during execution time as part of the dynamic block rendering (render callbacks are executed when visiting a post that contains the block).

Since that logic runs in the server, we should be able to check the account_disconnected flag and if for any reason the flag exists but the Stripe connection is set, we can recreate the plans with the new Stripe account, making sure that the returned plans will work in the payment dialog.

mmtr avatar Sep 01 '20 17:09 mmtr

I just had a customer report this in 25987821-hc

happychait avatar Nov 29 '20 21:11 happychait

I encountered this same error message with the Premium Content block in 25938511-hc

They mentioned it was the first time they were connecting, however previously used the same Stripe account with Medium.

metabreakr avatar Nov 30 '20 16:11 metabreakr

Got another in 26008195-hc

metabreakr avatar Nov 30 '20 16:11 metabreakr

Another - 26008195-hc

eamcgill90 avatar Nov 30 '20 18:11 eamcgill90

Observed in a case where user first registered on WooCommerce Payments (that apparently creates a Stripe Express account), and then used the same credentials for Premium content block.

3519340-zd

nagpai avatar Dec 01 '20 02:12 nagpai

@mmtr Is it possible to fix this for individual customers while we're waiting for the bug itself to be fixed? I don't understand the bit about deleting the old plan. What sort of plan? How does the user do this? I asked in #payments: p1607361090429500-slack-C02BEP610

eurello avatar Dec 07 '20 21:12 eurello

@mmtr Is it possible to fix this for individual customers while we're waiting for the bug itself to be fixed? I don't understand the bit about deleting the old plan. What sort of plan? How does the user do this? I asked in #payments: p1607361090429500-slack-C02BEP610

They have to create a new payment plan in wordpress.com/earn/payments-plans/:site(Tools > Earn > Manage payments > Collect payments > Manage plans > Payment plans): https://wordpress.com/support/wordpress-editor/blocks/payments/#managing-payment-plans

Once the plan has been created, they have to switch any existing Payments / Premium content block to the new plan by editing the posts containing such blocks: https://wordpress.com/support/wordpress-editor/blocks/payments/#payment-block-settings

mmtr avatar Dec 08 '20 11:12 mmtr

Another one - 26398923-hc The user created a new plan and added it again to the payment block. But they are still seeing the same issue.

yashitamittal11 avatar Dec 17 '20 10:12 yashitamittal11

3593671-zen

metabreakr avatar Dec 22 '20 22:12 metabreakr

Another report in 26335896-hc, suggested deleting plan and re-adding as a workaround.

jamiepalatnik avatar Dec 30 '20 23:12 jamiepalatnik

Another report in 23452958-hc, the new plan workaround did not work for them.

NoHopeRadio avatar Jan 11 '21 21:01 NoHopeRadio

Another report in 3698959-zd, with the Donation block

kathleenjross avatar Jan 31 '21 19:01 kathleenjross

Another report for the Payments Block: 18504186-zen

eoinsav avatar Feb 11 '21 00:02 eoinsav

Another report: 27662821-hc

Re-created the plan didn't do the trick. I'm going to do the workaround @yashitamittal11 provided on their follow-up: Creating a new Stripe account.

retnonindya avatar Feb 11 '21 03:02 retnonindya

Another report for Payments block in 27711962-hc

noteeth avatar Feb 13 '21 04:02 noteeth

Another report for Payments block in 17465695-hc I'll ask them to make a new payment option.

kaitohm avatar Feb 16 '21 00:02 kaitohm

Another report for Payments block in 28150296-hc

thabotswana avatar Mar 03 '21 11:03 thabotswana