Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for WooPayments as a payment gateway #3494

Open
wants to merge 9 commits into
base: feat/stripe-settings-page
Choose a base branch
from

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Oct 23, 2024

All Submissions:

Changes proposed in this Pull Request:

Adds support for payment gateways beyond Stripe in the Reader Revenue > Payment Methods dashboard page. This PR adds WooPayments as a first-party payment gateway option and upgrades this plugin to Newspack's list of "managed" plugins that can be auto-installed in one click.

Because the Transaction Fee options apply to both Stripe and WooPayments gateways, these options have been moved outside of the Stripe component, as well as the data payload for Stripe, and into its own component/endpoints.

Screenshot 2024-10-22 at 3 16 29 PM

This PR also updates the UI shown under "Reader Revenue" during the setup wizard. Previously, this component showed the Donation amounts UI, plus the UI to input Stripe API keys. Now, this component will show the platform selector plus the Donation amounts UI (this is so we can at least show something—otherwise if you get to the screen and you hadn't already installed Woo and Woo Subscriptions plugins, this component would be totally empty).

Lastly, this PR removes the plugin installer component shown if the required payment gateway plugin isn't installed or active on your site. Since our handler to enable plugin gateways will automatically install and activate the required plugin if it's missing, this is an unnecessary UI step.

How to test the changes in this Pull Request:

  1. Start with a fresh testing site and install this branch.
  2. Proceed through the initial setup steps. In the "Settings" step make sure to select a Country and a Currency before proceeding to the Services step. This will avoid a fatal error when enabling WooPayments for the first time (seems to be a bug with WooPayments, which assumes you've completed WooCommerce setup before enabling it).
  3. On the "Services" page, enable the Reader Revenue toggle and confirm you see the platform selector here. Confirm that you can switch back and forth between platforms:
Screenshot 2024-10-22 at 4 47 47 PM
  1. Select "Newspack" and confirm that you see the required plugins component:
Screenshot 2024-10-22 at 4 49 09 PM
  1. Confirm that you can install WooCommerce using the "Install" link. You won't be able to install Woo Subscriptions here, so install it using CLI then refresh the page (you may have to exit the WooCommerce onboarding screen and proceed through the initial Newspack setup steps again—for this reason for most site setups it probably makes sense to preinstall the required Woo plugins before initiating the setup wizard).
  2. Now when enabling Reader Revenue in the Services page, you should see the basic donation amounts UI (this should be the same as before, just minus the Stripe settings):
Screenshot 2024-10-23 at 3 45 54 PM
  1. Complete the setup wizard, then go to Newspack > Reader Revenue > Payment Methods. Confirm you see the new payment gateways UI:
Screenshot 2024-10-23 at 3 49 17 PM
  1. Toggle ON both payment gateways. Confirm that both enter an enabled but "not connected" state, and confirm that the "Additional Settings" card appears below them. Confirm that you can update and save the transaction fee fields in "Additional Settings".
Screenshot 2024-10-23 at 3 51 07 PM
  1. Click on "Connect" for each payment gateway and confirm that each leads to the screen to initiate the connection process for that payment gateway.
  2. Complete the connection flows for both Stripe and WooPayments in test mode (you will need to log into a Stripe test account to complete both flows).
  • For Stripe, click the "Create or connect a test account instead" link:
Screenshot 2024-10-23 at 3 52 09 PM
  • For WooPayments, expand the "I'm setting up a store for someone else" card and click the "Enable sandbox mode" button:
Screenshot 2024-10-23 at 3 51 43 PM
  1. After completing both connection flows, return to Newspack > Reader Revenue > Payment Methods and confirm that both payment gateways are shown as active and connected in test mode:
Screenshot 2024-10-23 at 3 55 32 PM
  1. Click the "Configure" button for each payment gateway and confirm that each leads to the settings page for that payment gateway plugin.
  2. Publish a Donate block on a post or page and visit as a reader. Start a donation checkout and confirm that you can complete a test transaction using both payment gateways (you should see two options for "Credit card"):
Screenshot 2024-10-23 at 3 58 59 PM
  1. Confirm that after toggling OFF either payment gateway in the Reader Revenue > Payment Methods page, that payment gateway is no longer available for checkout on the front-end.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo requested a review from a team as a code owner October 23, 2024 21:59
@dkoo dkoo self-assigned this Oct 23, 2024
@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Oct 23, 2024
@dkoo dkoo changed the title feat: support multiple payment gateways feat: support for WooPayments as a payment gateway Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The issue or pull request needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants