Fetch a subscriber’s active subscriptions from a headless or native client
Benecaster’s own account page is a WordPress page, which is no use to a headless front end or a native app. This endpoint returns the same information as data: every show the signed-in subscriber has access to, with its title, artwork, their tier, and the state of their subscription.
The feed URL comes back masked, and that is deliberate. A subscriber’s feed URL is the credential — anyone holding it has their subscription — so listing it in a routine account request would spread it further than it needs to go. You get enough to show the subscriber which feed is which, and revealing the whole thing is a separate, deliberate action on their part.
Code
<?php
// WordPress: fetch own subscriptions server-side (e.g. in a REST proxy add-on)
$response = wp_remote_get(
rest_url( 'benecaster/v1/account/subscriptions' ),
[
'cookies' => $_COOKIE, // forward logged-in user's cookies
]
);
$data = json_decode( wp_remote_retrieve_body( $response ), true );
foreach ( $data['items'] as $sub ) {
// $sub['show_title'], $sub['tier_name'], $sub['token_prefix'] etc.
}
Need this built rather than just documented? See our services →