woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 135 forks source link

[Mobile Payments] Onboarding may be better if it relied on payments_enabled in the WCPayAccount response #12847

Open joshheald opened 1 day ago

joshheald commented 1 day ago

There are some cases where onboarding can show an error in the app, even though the merchant could accept payments on the web.

This happens for some cases of progressive onboarding.

At present, passing our IPP onboarding relies on the following check, after any specific errors:

account.wcpayStatus == .complete ||
account.wcpayStatus == .enabled ||
account.wcpayStatus == .restrictedSoon ||
account.wcpayStatus == .pendingVerification

The pendingVerification step was added in response to one specific case of this issue, however we've had to gradually add more and more statuses to our list of "onboarding complete" statuses – originally, I believe it was only .complete that allowed a payment.

Potential solution

WCPay teams have advised that the payments_enabled flag may be a better indicator of whether a merchant can accept payments – this is what's used on the web.

See pdfdoF-5fQ-p2#comment-6364 for context.

This would be a significant change, and need investigation before deciding we should go ahead with it. It would also require significant testing. The onboarding flows were originally written with a lot of care, and trial-and-error, and should match exactly between iOS and Android for easier support.

One particular open question – does payments_enabled return true even if the WCPay gateway is not enabled on the web checkout? i.e. when the extension is enabled and onboarded, but its toggle in WPAdmin > WooCommerce > Settings > Payments > All Payment Gateways is off, the flag should still return true for it to be suitable for IPP.

dangermattic commented 1 day ago

Thanks for reporting! 👍

joshheald commented 1 day ago

Related to https://github.com/woocommerce/woocommerce-ios/issues/14263