PodcastPaymentGateway
\Benecaster\Payment\PodcastPaymentGateway
The payment gateway contract all gateway implementations must satisfy. Benecaster ships StripeGateway (slug benecaster_stripe). A gateway is registered through the benecaster_payment_gateways filter. is_test_mode() is mandatory — omitting it raises a PHP fatal at class load.
A registered gateway takes no payments yet. Benecaster’s checkout, renewals, account page and webhooks bill through Stripe directly and never call a registered gateway’s methods; today registration affects only test-mode reporting (the TEST MODE badge and benecaster_payment_test_mode_active()). The interface is being redesigned around the operations built-in membership really performs, so do not build a gateway against these signatures yet. A gateway add-on that calls its own processor should still guard every charge with the clone guard.
benecaster_payment_gateways passes objects, and it is the only registration filter in Benecaster that does. The two strategy filters — benecaster_related_episodes_query_types and benecaster_member_thanks_query_types — take a label and one callback each, because that is all a strategy is. A gateway is a seven-method lifecycle contract whose methods have to move together, and an array of loose callables cannot hold that. The asymmetry is deliberate.
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
get_gateway_slug(): string |
Public | — | Returns the stable slug identifying this gateway. Convention: benecaster_{processor}. Must be unique across all registered gateways. |
is_test_mode(): bool |
Public | — | Mandatory — omitting raises a PHP fatal. Returns whether the gateway is in test mode. Drives the persistent TEST MODE badge on all Benecaster admin screens and the subscriber account page banner. |
create_subscription(): \Stripe\Subscription |
Public | — | Creates a new subscription for a subscriber. |
cancel_subscription(): \Stripe\Subscription |
Public | — | Cancels an existing subscription. Default for StripeGateway: cancel_at_period_end = true so feed access continues through the current billing period. |
update_payment_method(): void |
Public | — | Updates the payment method on a subscriber's account. |
get_billing_history(): array |
Public | — | Returns a paginated list of invoices or billing events. Each entry must include at minimum: date, amount, currency, status, invoice_url. |
handle_webhook( \Stripe\Event $event ): void |
Public | — | Handles a raw event from the payment provider. For StripeGateway, fires the appropriate benecaster_stripe_membership_* routing action. |