Skip to main content

Listener Support Settings REST API

REST endpoints for reading and writing Listener Support configuration. All endpoints require manage_options + a valid X-WP-Nonce header. These endpoints live on the benecaster/v1 namespace on the main WordPress installation.


GET /benecaster/v1/listener-support/settings

Returns the current Listener Support configuration. Pass ?show_id=N to also receive the per-show override state and effective merged values.

Auth: manage_options + X-WP-Nonce

Query parameters:

Parameter Required Notes
show_id No When provided, the response includes the show object. Omit for site-wide settings only.

Response:

{
  "site": {
    "enabled":      true,
    "style":        "floating",
    "intent":       "non-subscribers",
    "payment_url":  "https://ko-fi.com/mypodcast",
    "button_label": "Support the show",
    "message":      "Enjoying the podcast? A small tip keeps it going."
  },
  "show": {
    "show_id":          5,
    "override_enabled": true,
    "overrides": {
      "payment_url":  "https://ko-fi.com/show2",
      "button_label": "Support Season 3"
    },
    "effective": {
      "enabled":      true,
      "style":        "floating",
      "intent":       "non-subscribers",
      "payment_url":  "https://ko-fi.com/show2",
      "button_label": "Support Season 3",
      "message":      "Enjoying the podcast? A small tip keeps it going."
    }
  }
}

The show key is only present when ?show_id=N is supplied.

Field reference — site object:

Field Type Description
enabled bool Whether Listener Support is active site-wide.
style string Display variant: 'inline', 'floating', or 'after-player'.
intent string Audience: 'all' (all visitors) or 'non-subscribers' (hide from active subscribers).
payment_url string External donation link. Empty string when not configured.
button_label string CTA button text.
message string Optional prompt body text.

Field reference — show object:

Field Type Description
show_id int The show ID passed in ?show_id=N.
override_enabled bool Whether this show uses per-show values instead of the site defaults.
overrides object Partial settings the podcaster explicitly overrode for this show. Keys absent when that setting was not overridden.
effective object Final merged config this show renders with — site values with overrides merged in when override_enabled is true. Same shape as site.

POST /benecaster/v1/listener-support/settings

Saves site-wide Listener Support settings. Pass any subset of the site keys — unknown keys are silently dropped.

Auth: manage_options + X-WP-Nonce

Request body:

{
  "enabled":      true,
  "style":        "inline",
  "intent":       "all",
  "payment_url":  "https://ko-fi.com/mypodcast",
  "button_label": "Buy me a coffee",
  "message":      ""
}

All fields are optional. Fields omitted from the body are left unchanged.

Response: The saved site object — same shape as in GET /settings.

Validation:

Field Rules
style Must be 'inline', 'floating', or 'after-player'.
intent Must be 'all' or 'non-subscribers'.
payment_url Sanitized via esc_url_raw.
button_label Sanitized via sanitize_text_field. Max 100 characters.
message Sanitized via sanitize_textarea_field. Max 500 characters.

Invalid values for style and intent return HTTP 400. Other fields with invalid values are sanitized to their default.


POST /benecaster/v1/listener-support/settings/show/{id}

Saves per-show Listener Support overrides for show {id}.

Auth: manage_options + X-WP-Nonce

Route parameter:

Parameter Description
{id} The benecaster_show post ID. Returns 404 when the show does not exist.

Request body:

{
  "override_enabled": true,
  "overrides": {
    "payment_url":  "https://ko-fi.com/show-specific-page",
    "button_label": "Support this show"
  }
}

override_enabled controls whether the per-show values replace site defaults. When false, the overrides object is stored but not applied — the show renders with site defaults until override_enabled is set back to true.

Pass only the keys you want to override in overrides. Keys absent from overrides are treated as “use site default for this setting.” To clear a previously set override, pass the key explicitly with its default value rather than omitting it.

Response: The saved show object including freshly computed effective values — same shape as in GET /settings?show_id=N.

Example — disable Listener Support for one show while keeping it active site-wide:

{
  "override_enabled": true,
  "overrides": {
    "enabled": false
  }
}

Example — reset a show to site defaults (remove all overrides):

{
  "override_enabled": false,
  "overrides": {}
}

See Also