Add multi-gateway support - #3631
Draft
dparker1005 wants to merge 1 commit into
Draft
Conversation
Adds the ability to enable multiple payment gateways simultaneously so members can choose their preferred payment method at checkout. Core infrastructure: - New pmpro_get_enabled_gateways() function with automatic migration from the legacy single pmpro_gateway option - New static methods on PMProGateway base class: get_checkout_label(), enqueue_checkout_scripts(), show_checkout_fields(), requires_billing_address(), get_required_billing_fields(), show_submit_button() with legacy hook detection for gateways that have not been updated - pmpro_getGateway() marked as deprecated Admin UI: - Payment Settings page redesigned with sortable Active Gateways table, collapsible Available Gateways panel, and activate/deactivate buttons - Gateway order determines checkout display order Checkout: - Gateway selector radio buttons rendered when multiple gateways enabled - Per-gateway payment field containers with JS-based toggling - Per-gateway submit buttons (offsite gateways show branded buttons) - Billing address visibility respects each gateway requirements - Free-level fallback submit button for discount-code-to-free scenarios - pmpro_show_gateway_selector filter for add-on compatibility Billing page: - Uses gateway static methods for field rendering and billing address Gateway updates (Stripe, Check, PayPal Express): - Override new static methods for gateway-specific behavior - Stripe: SCA intent localization preserved, Stripe Checkout (offsite) handled, billing address setting respected - Check: no payment fields, no billing address - PayPal Express: offsite redirect button, free-level fallback Backward compatibility: - Base class detects legacy filter callbacks via hooked filters AND class method existence (covers secondary gateways whose init did not fire) - pmpro_gateway option kept in sync for legacy code - Pay by Check add-on UI deferred via pmpro_show_gateway_selector - Add PayPal Express add-on added to deprecated add-ons list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to enable multiple payment gateways simultaneously so members can choose their preferred payment method at checkout. This is a v4.0 breaking change — custom checkout templates will need to be updated.
Core Infrastructure
pmpro_get_enabled_gateways()function with automatic migration from the legacy singlepmpro_gatewayoptionPMProGatewaybase class:get_checkout_label(),enqueue_checkout_scripts(),show_checkout_fields(),requires_billing_address(),get_required_billing_fields(),show_submit_button()— with legacy hook detection for gateways that haven't been updatedpmpro_getGateway()marked as deprecatedAdmin UI
Checkout & Billing
requires_billing_address()Gateway Updates (Stripe, Check, PayPal Express)
Backward Compatibility
method_exists()(covers secondary gateways whoseinit()didn't fire)pmpro_gatewayoption kept in sync for legacy codepmpro_show_gateway_selectorfilterOpen TODOs
applydiscountcode.phpJS approachrequires_billing_address()is per-gateway but there's no admin-facing overrideshow_checkout_fields()renders elements with the same IDs. Gateway JS that binds by ID hits the wrong element. Needs a namespacing strategyinit()only hooks checkout actions when they're the active gateway. They would needenqueue_checkout_scripts()overrides to work as secondary gateways@since TBDtags with actual version number before releaseTest Plan
🤖 Generated with Claude Code