---
title: Stripe Checkout Setup
menu_group: Subscriptions
menu_order: 50
tab: Stripe setup
tab_order: 90
admin_slug: wpst_subscription_payments
requires_subscriptions: true
summary: Complete Stripe Dashboard and WordPress setup for hosted checkout and webhooks.
---

# Stripe Checkout Setup

Complete guide to accepting subscription payments with Stripe Web Checkout (Phase 2A).

## Prerequisites

- `WPST_SUBSCRIPTIONS_ENABLED` set to `true` in `wp-config.php`
- **Enable REST/API access** under Subscriptions → General
- HTTPS recommended for production
- Stripe account with Products and recurring Prices for each tier

## Stripe Dashboard setup

### 1. API keys

In Stripe Dashboard → **Developers → API keys**:

- Copy **test** publishable and secret keys into MediaBlaster → Subscriptions → **Payment Providers**
- When ready for production, repeat with **live** keys and switch **Mode** to Live

### 2. Webhook endpoint

Add a webhook in Stripe Dashboard pointing to:

```
https://YOUR-SITE/wp-json/mediablaster/v3/payments/stripe/webhook
```

Subscribe to these events (test and live each need their own endpoint or secret):

- `checkout.session.completed`
- `customer.subscription.created`
- `customer.subscription.updated`
- `customer.subscription.deleted`
- `invoice.payment_succeeded`
- `invoice.payment_failed`

Copy the **signing secret** into the matching test/live webhook secret field in MediaBlaster.

### 3. Products and Prices

Create a Stripe Product and recurring Price for each MediaBlaster tier. Copy each **Price ID** (`price_...`) into [Subscription Tiers](subscriptions-tiers.md) for the correct test or live mode.

Trial days configured on a tier are sent to Stripe as `trial_period_days` on checkout.

## WordPress configuration

| Setting | Example |
|---------|---------|
| Checkout success URL | `https://yoursite.com/subscribe-success/?session_id={CHECKOUT_SESSION_ID}` |
| Checkout cancel URL | `https://yoursite.com/subscribe/` |
| Portal return URL | `https://yoursite.com/account/` |

Create WordPress pages:

```
[wpst_subscribe]
[wpst_account]
```

See [Shortcodes](shortcodes.md) for single-tier checkout with `[wpst_stripe_checkout]`.

## Checkout flow

1. Logged-in user clicks **Subscribe** on your subscribe page
2. Browser requests a checkout session from MediaBlaster REST API
3. User completes payment on Stripe hosted checkout
4. Stripe redirects to your success URL
5. Webhooks update the internal subscription — premium access applies

## Testing checklist

Use Stripe test card **4242 4242 4242 4242** with any future expiry and CVC.

- [ ] Test keys saved; webhook secret configured
- [ ] Tier has test Price ID mapped
- [ ] Logged-out user sees login prompt on subscribe page
- [ ] Logged-in user reaches Stripe Checkout
- [ ] Success and cancel redirects work
- [ ] Sub Logs show `checkout.session.completed`
- [ ] Subscriber can play premium `[tv-video-player]` content
- [ ] **Manage Billing** opens Stripe Customer Portal on account page

## Troubleshooting

| Symptom | Check |
|---------|-------|
| No Subscribe button | User logged in? Stripe enabled? Tier has Price ID for current mode? |
| Checkout REST error | Subscriptions and REST API enabled? User authenticated? |
| Webhook signature failure | Webhook secret matches current test/live mode |
| Subscription not created | Sub Logs for `unmapped` or `error`; Price ID matches Stripe subscription |
| Manage Billing missing | User needs Stripe customer ID from completed checkout |

## Security

- Webhooks verify Stripe HMAC signatures only — no WordPress login
- Secret keys never appear in public REST or page HTML
- Redirect URLs must be same-site unless filtered for your domain

## Headless apps

`GET /wp-json/mediablaster/v3/app/config` returns public Stripe config (publishable key, endpoints) without secrets. Authenticated apps use `POST /wp-json/mediablaster/v3/payments/stripe/create-checkout-session` with Bearer token.

For REST auth details see [API/Auth settings](subscriptions-api-auth.md).
