Skip to main content

PayPal Sandbox Setup

This tutorial walks you through setting up PayPal in sandbox mode to safely test your subscription system without processing real money.

Estimated time: 20-25 minutes

Prerequisites

  • PaywallWP Pro installed and activated
  • SSL certificate (HTTPS) on your site
  • A PayPal account (personal or business)

Step 1: Access PayPal Developer Dashboard

1.1 Log In to Developer Dashboard

  1. Go to https://developer.paypal.com/
  2. Click Log in to Dashboard button (top right)
  3. Log in with your regular PayPal account credentials
  4. If prompted, accept the developer agreement

1.2 Ensure Sandbox Mode

  1. Look at the top navigation bar of the dashboard
  2. Find the Sandbox / Live toggle switch
  3. Make sure Sandbox is selected (highlighted)
Sandbox Environment

Sandbox is PayPal's test environment. It's completely separate from live — no real money is involved, and you can test freely without consequences.


Step 2: Create REST API App

You need an API "app" to get credentials for PaywallWP.

2.1 Navigate to Apps & Credentials

  1. In the left sidebar, click Apps & Credentials

    Direct URL: https://developer.paypal.com/dashboard/applications/sandbox

  2. Make sure you're on the Sandbox tab (not Live)

2.2 Create New App

  1. Click Create App button

  2. Fill in app details:

    FieldValueNotes
    App NamePaywallWPOr any name you prefer
    Sandbox Business AccountSelect default or create newThis is the merchant account
  3. Under App Type, select Merchant

  4. Click Create App

2.3 Copy API Credentials

After creating the app, you'll see the credentials page:

CredentialWhere to FindFormat
Client IDDisplayed openly on pageLong alphanumeric string
SecretClick Show button to revealLong alphanumeric string

Copy and save both credentials — you'll need them in Step 5.

Copy Carefully
  • Click Show to reveal the Secret (it's hidden by default)
  • Click Copy buttons to avoid typos
  • Save both values somewhere secure

Step 3: Understand Sandbox Accounts

PayPal Sandbox provides two test accounts automatically:

Account TypePurposeUse For
BusinessMerchant/SellerCreating products, receiving payments
PersonalBuyer/CustomerTesting purchases

3.1 Access Sandbox Accounts

  1. In Developer Dashboard, click Sandbox in left sidebar

  2. Click Accounts

    Direct URL: https://developer.paypal.com/dashboard/accounts

  3. You'll see two pre-created accounts:

    • One marked Business (seller)
    • One marked Personal (buyer)

3.2 Get Business Account Credentials

You'll need to log into sandbox PayPal to create subscription plans:

  1. Find the account with Type: Business
  2. Click the ... (three dots) menu on the right
  3. Click View/Edit Account
  4. Note down:

3.3 Get Personal (Buyer) Account Credentials

For testing purchases:

  1. Find the account with Type: Personal
  2. Click ...View/Edit Account
  3. Note down:
Save These Credentials

Keep both sandbox account credentials handy. You'll use:

  • Business account → to create plans (Step 4)
  • Personal account → to test purchases (Step 7)

Step 4: Create Subscription Product & Plan in PayPal

PayPal requires creating a Product (what you sell) and a Plan (pricing/billing).

4.1 Log In to Sandbox PayPal Business

  1. Open a new browser tab (or incognito window)
  2. Go to https://www.sandbox.paypal.com/
  3. Log in with your Sandbox Business account credentials (from Step 3.2)
Use sandbox.paypal.com

Make sure you're on sandbox.paypal.com (test environment), NOT www.paypal.com (live).

4.2 Navigate to Subscriptions

  1. After logging in, look for the main navigation

  2. Click Pay & Get Paid in the top menu

  3. Click Subscriptions from the dropdown

    Or go directly to: https://www.sandbox.paypal.com/billing/subscriptions

4.3 Create a Product

Before creating a plan, you need a product:

  1. On the Subscriptions page, click Create Plan

  2. You'll be prompted to select or create a product

  3. Click Create a Product

  4. Fill in product details:

    FieldExampleNotes
    Product NamePremium MembershipCustomer-facing name
    Product TypeServiceor Digital/Physical goods
    Product IDLeave blankAuto-generated
    DescriptionFull access to premium contentOptional but recommended
    Product URLYour website URLOptional
    Image URLProduct image URLOptional
  5. Click Create Product

4.4 Create a Subscription Plan

After creating the product:

  1. You'll be taken to the plan creation screen

  2. Fill in plan details:

    FieldExampleNotes
    Plan NamePremium MonthlyInternal reference
    DescriptionMonthly subscriptionCustomer-facing
  3. Configure Billing Cycle:

    FieldExample
    Tenure TypeRegular
    Price9.99
    CurrencyUSD
    Billing IntervalMonth
    Interval Count1
    Total Cycles0 (infinite)
  4. Payment Preferences (optional):

    • Setup Fee: 0
    • Auto-billing for failed payments: Yes
  5. Click Save Plan

4.5 Activate the Plan

After saving:

  1. Find your new plan in the plans list
  2. Click Turn Plan On (or toggle to Active)
  3. The plan status should change to Active

4.6 Copy the Plan ID

  1. Click on your plan to view details

  2. Find the Plan ID — starts with P-

    Example: P-5ML4271244454362WXNWU5NQ

  3. Copy and save this ID

Creating Yearly Plans

Repeat steps 4.4-4.6 to create additional plans (e.g., yearly at $99):

  • Same product, different plan
  • Set Billing Interval to "Year"
  • Copy each Plan ID

Step 5: Set Up Webhooks

Webhooks notify PaywallWP when subscription events occur.

5.1 Navigate to Webhooks

  1. Go back to the PayPal Developer Dashboard
  2. Click Apps & Credentials in left sidebar
  3. Click on your app name (e.g., "PaywallWP")
  4. Scroll down to the Webhooks section

5.2 Add Webhook Endpoint

  1. Click Add Webhook

  2. Enter your Webhook URL:

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

    Replace yoursite.com with your actual domain. Must use HTTPS.

  3. Under Events, select these subscription events:

    EventPurpose
    BILLING.SUBSCRIPTION.ACTIVATEDNew subscription started
    BILLING.SUBSCRIPTION.CANCELLEDSubscriber canceled
    BILLING.SUBSCRIPTION.EXPIREDSubscription period ended
    BILLING.SUBSCRIPTION.SUSPENDEDPayment failed, sub paused
    PAYMENT.SALE.COMPLETEDPayment received
    PAYMENT.SALE.REFUNDEDRefund processed
    Selecting Events

    Type "BILLING.SUBSCRIPTION" in the search box to filter. Then add the PAYMENT.SALE events.

  4. Click Save

5.3 Copy Webhook ID

After saving:

  1. Your webhook appears in the Webhooks list
  2. Find the Webhook ID column
  3. Copy the ID (alphanumeric string like 5GP028458F637750H)
Webhook ID ≠ Client ID

The Webhook ID looks similar to the Client ID but they're different values!

  • Client ID = API credentials (for authentication)
  • Webhook ID = Identifies this specific webhook endpoint

Make sure you copy from the Webhooks section, not the credentials section.


Step 6: Configure PaywallWP Settings

6.1 Open Payment Settings

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

6.2 Configure PayPal

  1. Find the PayPal section

  2. Click the Sandbox button to select it

  3. Enter your credentials:

    FieldValueFrom
    Sandbox Client IDYour Client IDStep 2.3
    Sandbox Client SecretYour SecretStep 2.3
    Sandbox Webhook IDYour Webhook IDStep 5.3
  4. Click Save Settings

Verify Settings

After saving, if you see error messages about invalid credentials:

  • Check for extra spaces before/after values
  • Verify you copied from Sandbox (not Live)
  • Make sure the app is active

Step 7: Create Plan in PaywallWP

7.1 Create New Plan

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

7.2 Configure Plan Details

FieldExampleNotes
Plan NamePremiumCustomer-facing name
SlugpremiumURL identifier
Monthly Price9.99Must match PayPal plan price
Yearly Price99.00Optional, must match PayPal
Access Level51-10, higher = more access
Price Matching

PaywallWP plan prices must match your PayPal subscription plan prices exactly.

7.3 Add Features List

Enter features shown on your pricing page (one per line):

Unlimited access to premium content
Weekly exclusive newsletter
Ad-free reading experience
Members-only community access
Priority email support

7.4 Publish

  1. Set Status to Published
  2. Click Publish

Step 8: Test the Integration

8.1 Protect Test Content

  1. Edit any post or page
  2. Find Content Protection meta box
  3. Set Access Level ≤ your plan's access level
  4. Update the post

8.2 Test Payment Flow

  1. Open an incognito/private browser window

  2. Visit your protected post

  3. You should see the paywall

  4. Click Subscribe and choose PayPal

  5. You'll be redirected to sandbox.paypal.com

  6. Log in with your Sandbox Personal account (from Step 3.3):

  7. Review and approve the subscription

  8. Complete checkout — you'll be redirected back to your site

8.3 Alternative: Test with Card in Sandbox

You can also use test cards in PayPal sandbox:

Card TypeNumberCVV
Visa4111111111111111Any 3 digits
Mastercard5555555555554444Any 3 digits
Amex378282246310005Any 4 digits
  • Use any future expiry date
  • Use any billing address

8.4 Verify Success

Check PaywallWP:

  1. Go to PaywallWP → Members
  2. New member should appear with "Active" status
  3. Plan should show your plan name

Check PayPal Webhooks:

  1. Go to Developer Dashboard → Apps & Credentials → Your App
  2. Scroll to Webhooks
  3. Click on your webhook
  4. Check Event Log or recent deliveries
  5. Should show HTTP 200 status (success)

Test Content Access:

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

Troubleshooting

"Invalid Client ID" Error

Solutions:

  • Verify you're using Sandbox credentials (not Live)
  • Check Client ID is complete (no extra spaces)
  • Confirm app is active and on Sandbox mode
  • Re-copy the credentials carefully

PayPal Login Popup Blocked

Solutions:

  • Allow popups from your site in browser settings
  • Temporarily disable ad blockers
  • Try a different browser
  • PayPal requires popups for authentication flow

"Something went wrong" During Checkout

Solutions:

  • Check browser console for JavaScript errors
  • Verify SSL certificate is valid
  • Ensure REST API is accessible
  • Check PayPal app permissions include "Subscriptions"

Webhook Not Receiving Events

Solutions:

  • Verify webhook URL uses HTTPS
  • Check Webhook ID is correct (not Client ID!)
  • Use PayPal's Webhook Simulator to test:
    1. Developer Dashboard → Testing Tools → Webhooks
    2. Select your webhook
    3. Choose an event type
    4. Click Send Test
  • Check your server isn't blocking PayPal IPs

Subscription Not Activating After Payment

This is always a webhook issue. Check:

  1. Webhook ID matches the one in PaywallWP settings
  2. Webhook events are being received (check event log)
  3. Enable WP_DEBUG_LOG and check /wp-content/debug.log
  4. Verify all required events are selected for the webhook

Test Buyer Has No Balance

Solutions:

  • Sandbox personal accounts have automatic test balance
  • If needed, edit the sandbox account and add funds
  • Or create a new sandbox personal account with balance

Sandbox URLs Reference

PurposeURL
Developer Dashboardhttps://developer.paypal.com/dashboard/
Sandbox Accountshttps://developer.paypal.com/dashboard/accounts
Apps & Credentialshttps://developer.paypal.com/dashboard/applications/sandbox
Sandbox PayPal Loginhttps://www.sandbox.paypal.com/
Webhook Simulatorhttps://developer.paypal.com/dashboard/webhooksSimulator

Next Steps

You've completed PayPal sandbox setup!