Stripe_Gateway::class, 'paypal' => Paypal_Gateway::class, ]; /** Resolves a stored (or missing) gateway id to a real, known gateway class — always falls back to the default rather than erroring, since every payment_method field saved before PayPal existed has no `gateway` value at all and must keep behaving exactly as it did before. */ public static function get( $gateway_id ) { return self::$gateways[ $gateway_id ] ?? self::$gateways[ self::DEFAULT_GATEWAY ]; } public static function ids(): array { return array_keys( self::$gateways ); } /** * Detects recurring-billing capability via the gateway class actually * implementing Subscription_Gateway_Interface, not a hardcoded * `'stripe' === $gateway_id` check — the extensibility seam a future * PayPal-subscriptions or Square gateway plugs into automatically the * moment it implements the interface and registers itself above, * with zero changes needed in SubmissionHandler, RestApi, or the * builder's Field Settings panel (all three call this instead of * naming a gateway). */ public static function supports_subscriptions( $gateway_id ) { return in_array( Subscription_Gateway_Interface::class, class_implements( self::get( $gateway_id ) ) ?: [], true ); } }