Skip to main content

Stripe Test Mode Setup

This tutorial walks you through setting up Stripe in test mode to safely develop and test your subscription system.

Estimated time: 15-20 minutes

Prerequisites

  • PaywallWP Pro installed and activated
  • SSL certificate (HTTPS) on your site

Step 1: Create Stripe Account & Get Test API Keys

1.1 Create or Log In to Stripe

  1. Go to https://dashboard.stripe.com/register
  2. Create a new account or log in to existing account
  3. Complete account setup if prompted (email verification, etc.)

1.2 Enable Test Mode

  1. Look at the top-right corner of the dashboard
  2. Find the "Test mode" toggle switch
  3. Click to enable it — the toggle should show orange/yellow color
  4. You'll see "TEST DATA" badge appear in the dashboard header
Visual Indicator

When test mode is enabled, you'll see an orange banner and "Test mode" label throughout the dashboard. All data you create here is separate from live data.

1.3 Get Your Test API Keys

  1. Click Developers in the left sidebar

  2. Click API keys

    Direct URL: https://dashboard.stripe.com/test/apikeys

  3. You'll see two keys:

    Key TypeFormatVisibility
    Publishable keypk_test_...Visible by default
    Secret keysk_test_...Hidden — click "Reveal"
  4. Copy both keys and save them somewhere secure — you'll need them in Step 4

Revealing the Secret Key

Click the "Reveal test key" button next to the Secret key. You may need to re-authenticate with your password or 2FA.

Keep Keys Secure
  • Publishable key (pk_test_) — Safe to use in frontend code
  • Secret key (sk_test_) — Never expose publicly, server-side only

Step 2: Create a Subscription Product & Price

Stripe organizes subscriptions as Products (what you're selling) with Prices (how much and how often).

2.1 Navigate to Product Catalog

  1. In Stripe Dashboard, click More + in the left sidebar

  2. Click Product catalog

    Direct URL: https://dashboard.stripe.com/test/products

2.2 Create a New Product

  1. Click + Add product button (top right)

  2. Fill in Product information:

    FieldExampleRequired
    NamePremium MembershipYes
    DescriptionFull access to all premium articles and exclusive contentOptional
    ImageUpload a product image (recommended 512x512px)Optional
Product Naming

Use clear, customer-facing names. This name appears on invoices and the customer portal.

2.3 Add Recurring Price

  1. Scroll down to Price information section

  2. Select Recurring (not One time)

  3. Fill in pricing details:

    FieldExampleNotes
    Amount9.99Price per billing period
    CurrencyUSDMatch your PaywallWP currency
    Billing periodMonthlyMonthly, Yearly, Weekly, etc.
  4. Click Add product to save

Offering annual pricing typically increases revenue. To add:

  1. Go back to your product in Product catalog
  2. Click on the product name to open it
  3. In the Pricing section, click + Add another price
  4. Configure the yearly price:
    FieldExample
    Amount99.00
    CurrencyUSD
    Billing periodYearly
  5. Click Add price
Annual Discount

A common practice is ~17% discount for annual (e.g., $9.99/mo = $120/yr, but offer $99/yr). This encourages longer commitments.

2.5 Copy Your Price IDs

Each price has a unique identifier used by PaywallWP:

  1. On the product page, find your prices listed under Pricing
  2. Each price shows an ID starting with price_
  3. Click on a price row to expand details
  4. Copy the Price ID (e.g., price_1ABC123xyz...)
PriceExample ID
Monthlyprice_1AbC2dEfGhIjK3lM
Yearlyprice_1NoPqRsTuVwXyZ4a
Automatic Sync

PaywallWP syncs with Stripe automatically — you don't need to manually enter Price IDs. However, knowing where to find them helps with troubleshooting.


Step 3: Set Up Webhooks

Webhooks are essential. They notify PaywallWP when payments succeed, subscriptions change, renewals process, etc. Without webhooks, subscriptions won't activate.

3.1 Navigate to Webhooks

  1. In Stripe Dashboard, click Developers in the left sidebar

  2. Click Webhooks

    Direct URL: https://dashboard.stripe.com/test/webhooks

3.2 Create Webhook Endpoint

  1. Click + Add endpoint button

  2. Enter your Endpoint URL:

    https://yoursite.com/wp-json/paywallwp/v1/stripe-webhook
    Replace Domain

    Replace yoursite.com with your actual domain. The URL must use HTTPS.

  3. Click + Select events

  4. In the event selector, search and check each of these events:

    EventPurposeCritical?
    checkout.session.completedNew subscription payment completedYes
    customer.subscription.createdNew subscription createdYes
    customer.subscription.updatedPlan changes, renewals, status changesYes
    customer.subscription.deletedSubscription canceled/endedYes
    invoice.paidRecurring payment successfulYes
    invoice.payment_failedRecurring payment failedYes
    charge.refundedRefund issuedRecommended
  5. Click Add events to confirm selection

  6. Click Add endpoint to create the webhook

3.3 Copy Webhook Signing Secret

The signing secret verifies webhook requests actually come from Stripe:

  1. Click on your newly created webhook endpoint to open it

  2. Find the Signing secret section (right side)

  3. Click Reveal to show the secret

  4. Copy the secret — it starts with whsec_

    Example: whsec_1234567890abcdefghijklmnop

Critical Distinction
KeyStarts WithPurpose
API Secret Keysk_test_Authenticate API requests
Webhook Signing Secretwhsec_Verify webhook authenticity

These are different values. Make sure you copy the webhook signing secret (whsec_), not your API secret key (sk_test_).


Step 4: Configure PaywallWP Settings

4.1 Open Payment Settings

  1. In WordPress admin, go to PaywallWP → Settings
  2. Click the Payments tab

4.2 Configure Stripe

  1. Find the Stripe section

  2. Click the Test Mode button to select it (button should appear active/highlighted)

  3. Enter your credentials:

    FieldValueFrom
    Test Publishable Keypk_test_...Step 1.3
    Test Secret Keysk_test_...Step 1.3
    Test Webhook Secretwhsec_...Step 3.3
  4. Click Save Settings

Verify Keys

After saving, if keys are invalid, you'll see an error message. Double-check for:

  • Extra spaces before/after the key
  • Missing characters (keys are long!)
  • Mixing up test and live keys

Step 5: Create Plan in PaywallWP

5.1 Create New Plan

  1. Go to PaywallWP → Plans
  2. Click Add New Plan

5.2 Configure Plan Details

FieldExampleNotes
Plan NamePremiumCustomer-facing name
SlugpremiumURL-friendly identifier
Monthly Price9.99Must match your Stripe price
Yearly Price99.00Optional, must match Stripe
Access Level51-10, higher = more access
Trial Days0Free trial period (optional)
Price Matching

Your PaywallWP plan prices must match your Stripe product prices exactly. If Stripe has $9.99/month, PaywallWP must also have $9.99/month.

5.3 Add Features List

Enter the features/benefits shown on your pricing page. One feature per line:

Unlimited access to all premium articles
Weekly exclusive newsletter
Ad-free reading experience
Members-only community forum
Early access to new content
Direct support via email

5.4 Publish

  1. In the Publish meta box, set Status to Published
  2. Click Publish button

Step 6: Test the Integration

6.1 Protect a Post

  1. Edit any post or page
  2. Find the Content Protection meta box in the sidebar (or below editor)
  3. Set Access Level to a value ≤ your plan's access level
    • Example: If plan has Access Level 5, set post to 5 or lower
  4. Click Update to save

6.2 Test Payment Flow

  1. Open an incognito/private browser window (important — avoids cached login)

  2. Visit your protected post

  3. You should see the paywall blocking content

  4. Click the Subscribe or Choose Plan button

  5. Select your plan and proceed to checkout

  6. Use Stripe's test card:

    FieldValue
    Card number4242 4242 4242 4242
    Expiry dateAny future date (e.g., 12/34)
    CVCAny 3 digits (e.g., 123)
    ZIP/Postal codeAny 5 digits (e.g., 12345)
    Cardholder nameAny name
  7. Complete the checkout

6.3 Additional Test Cards

Card NumberScenario
4242 4242 4242 4242Successful payment
4000 0000 0000 0002Card declined
4000 0000 0000 9995Insufficient funds
4000 0025 0000 3155Requires 3D Secure authentication
4000 0000 0000 32203D Secure 2 required

All test cards use:

  • Any future expiry date
  • Any 3-digit CVC
  • Any billing details
Full Test Card List

See Stripe's Testing Documentation for the complete list of test card numbers.

6.4 Verify Success

Check PaywallWP Members:

  1. Go to PaywallWP → Members
  2. You should see the new subscriber
  3. Status should show "Active"
  4. Plan should show your plan name

Check Stripe Dashboard:

  1. Go to https://dashboard.stripe.com/test/payments
  2. You should see the test payment
  3. Go to Customers to see the new customer

Check Webhook Delivery:

  1. Go to https://dashboard.stripe.com/test/webhooks
  2. Click your webhook endpoint
  3. Check Recent deliveries section
  4. All deliveries should show ✓ green checkmark (HTTP 200)

Test Content Access:

  1. In the same incognito window (now logged in as subscriber)
  2. Visit the protected post
  3. Full content should now be visible without paywall

Troubleshooting

"Invalid API Key" Error

Symptoms: Error when saving settings or during checkout

Solutions:

  • Verify keys are copied completely (no extra spaces)
  • Confirm you're using test keys (start with pk_test_ and sk_test_)
  • Make sure Test Mode is selected in PaywallWP (not Live Mode)
  • Try revealing and re-copying the keys from Stripe

Webhook Shows Errors (HTTP 4xx/5xx)

Symptoms: Webhook deliveries show red X marks in Stripe

Solutions:

  • Check webhook URL is exactly correct (no typos)
  • Verify your site uses HTTPS (not HTTP)
  • Check if a security plugin is blocking REST API requests
  • Temporarily disable firewall/security plugins to test
  • Check the specific error message in Stripe's webhook logs
  • Verify WordPress permalinks aren't set to "Plain"

Payment Succeeds but Subscription Not Active

Symptoms: Card charged, but member not showing in PaywallWP

This is always a webhook issue. Check:

  1. Webhook signing secret is correct (whsec_..., not sk_test_...)
  2. Webhook deliveries are succeeding (green checkmarks)
  3. All required events are selected
  4. Enable WP_DEBUG and check /wp-content/debug.log for errors

Test Card Declined

Symptoms: Test card number not working

Solutions:

  • Use 4242 4242 4242 4242 for successful payments
  • Ensure Test Mode is enabled in both Stripe Dashboard AND PaywallWP
  • Check you're on sandbox.stripe.com (test mode), not live dashboard

3D Secure Popup Not Appearing

Symptoms: Payment hangs when using 3DS test cards

Solutions:

  • Ensure your site uses HTTPS
  • Check browser isn't blocking popups
  • Disable ad blockers temporarily
  • Try a different browser

Local Development (Optional)

For testing webhooks on localhost, use Stripe CLI:

# Install Stripe CLI (macOS)
brew install stripe/stripe-cli/stripe

# Or download from https://stripe.com/docs/stripe-cli

# Login to your Stripe account
stripe login

# Forward webhooks to your local site
stripe listen --forward-to localhost/wp-json/paywallwp/v1/stripe-webhook

The CLI outputs a webhook signing secret for local testing. Use this temporary secret in PaywallWP settings while developing locally.


Next Steps

You've completed Stripe test mode setup!