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
- Go to https://developer.paypal.com/
- Click Log in to Dashboard button (top right)
- Log in with your regular PayPal account credentials
- If prompted, accept the developer agreement
1.2 Ensure Sandbox Mode
- Look at the top navigation bar of the dashboard
- Find the Sandbox / Live toggle switch
- Make sure Sandbox is selected (highlighted)
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
-
In the left sidebar, click Apps & Credentials
Direct URL: https://developer.paypal.com/dashboard/applications/sandbox
-
Make sure you're on the Sandbox tab (not Live)
2.2 Create New App
-
Click Create App button
-
Fill in app details:
Field Value Notes App Name PaywallWP Or any name you prefer Sandbox Business Account Select default or create new This is the merchant account -
Under App Type, select Merchant
-
Click Create App
2.3 Copy API Credentials
After creating the app, you'll see the credentials page:
| Credential | Where to Find | Format |
|---|---|---|
| Client ID | Displayed openly on page | Long alphanumeric string |
| Secret | Click Show button to reveal | Long alphanumeric string |
Copy and save both credentials — you'll need them in Step 5.
- 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 Type | Purpose | Use For |
|---|---|---|
| Business | Merchant/Seller | Creating products, receiving payments |
| Personal | Buyer/Customer | Testing purchases |
3.1 Access Sandbox Accounts
-
In Developer Dashboard, click Sandbox in left sidebar
-
Click Accounts
Direct URL: https://developer.paypal.com/dashboard/accounts
-
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:
- Find the account with Type: Business
- Click the ... (three dots) menu on the right
- Click View/Edit Account
- Note down:
- Email ID (e.g.,
[email protected]) - System Generated Password (or set your own)
- Email ID (e.g.,
3.3 Get Personal (Buyer) Account Credentials
For testing purchases:
- Find the account with Type: Personal
- Click ... → View/Edit Account
- Note down:
- Email ID (e.g.,
[email protected]) - Password
- Email ID (e.g.,
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
- Open a new browser tab (or incognito window)
- Go to https://www.sandbox.paypal.com/
- Log in with your Sandbox Business account credentials (from Step 3.2)
Make sure you're on sandbox.paypal.com (test environment), NOT www.paypal.com (live).
4.2 Navigate to Subscriptions
-
After logging in, look for the main navigation
-
Click Pay & Get Paid in the top menu
-
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:
-
On the Subscriptions page, click Create Plan
-
You'll be prompted to select or create a product
-
Click Create a Product
-
Fill in product details:
Field Example Notes Product Name Premium Membership Customer-facing name Product Type Service or Digital/Physical goods Product ID Leave blank Auto-generated Description Full access to premium content Optional but recommended Product URL Your website URL Optional Image URL Product image URL Optional -
Click Create Product
4.4 Create a Subscription Plan
After creating the product:
-
You'll be taken to the plan creation screen
-
Fill in plan details:
Field Example Notes Plan Name Premium Monthly Internal reference Description Monthly subscription Customer-facing -
Configure Billing Cycle:
Field Example Tenure Type Regular Price 9.99 Currency USD Billing Interval Month Interval Count 1 Total Cycles 0 (infinite) -
Payment Preferences (optional):
- Setup Fee: 0
- Auto-billing for failed payments: Yes
-
Click Save Plan
4.5 Activate the Plan
After saving:
- Find your new plan in the plans list
- Click Turn Plan On (or toggle to Active)
- The plan status should change to Active
4.6 Copy the Plan ID
-
Click on your plan to view details
-
Find the Plan ID — starts with
P-Example:
P-5ML4271244454362WXNWU5NQ -
Copy and save this ID
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
- Go back to the PayPal Developer Dashboard
- Click Apps & Credentials in left sidebar
- Click on your app name (e.g., "PaywallWP")
- Scroll down to the Webhooks section
5.2 Add Webhook Endpoint
-
Click Add Webhook
-
Enter your Webhook URL:
https://yoursite.com/wp-json/paywallwp/v1/paypal-webhookReplace DomainReplace
yoursite.comwith your actual domain. Must use HTTPS. -
Under Events, select these subscription events:
Event Purpose 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 EventsType "BILLING.SUBSCRIPTION" in the search box to filter. Then add the PAYMENT.SALE events.
-
Click Save
5.3 Copy Webhook ID
After saving:
- Your webhook appears in the Webhooks list
- Find the Webhook ID column
- Copy the ID (alphanumeric string like
5GP028458F637750H)
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
- In WordPress admin, go to PaywallWP → Settings
- Click the Payments tab
6.2 Configure PayPal
-
Find the PayPal section
-
Click the Sandbox button to select it
-
Enter your credentials:
Field Value From Sandbox Client ID Your Client ID Step 2.3 Sandbox Client Secret Your Secret Step 2.3 Sandbox Webhook ID Your Webhook ID Step 5.3 -
Click Save 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
- Go to PaywallWP → Plans
- Click Add New Plan
7.2 Configure Plan Details
| Field | Example | Notes |
|---|---|---|
| Plan Name | Premium | Customer-facing name |
| Slug | premium | URL identifier |
| Monthly Price | 9.99 | Must match PayPal plan price |
| Yearly Price | 99.00 | Optional, must match PayPal |
| Access Level | 5 | 1-10, higher = more access |
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
- Set Status to Published
- Click Publish
Step 8: Test the Integration
8.1 Protect Test Content
- Edit any post or page
- Find Content Protection meta box
- Set Access Level ≤ your plan's access level
- Update the post
8.2 Test Payment Flow
-
Open an incognito/private browser window
-
Visit your protected post
-
You should see the paywall
-
Click Subscribe and choose PayPal
-
You'll be redirected to sandbox.paypal.com
-
Log in with your Sandbox Personal account (from Step 3.3):
- Email:
[email protected] - Password: (your sandbox personal password)
- Email:
-
Review and approve the subscription
-
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 Type | Number | CVV |
|---|---|---|
| Visa | 4111111111111111 | Any 3 digits |
| Mastercard | 5555555555554444 | Any 3 digits |
| Amex | 378282246310005 | Any 4 digits |
- Use any future expiry date
- Use any billing address
8.4 Verify Success
Check PaywallWP:
- Go to PaywallWP → Members
- New member should appear with "Active" status
- Plan should show your plan name
Check PayPal Webhooks:
- Go to Developer Dashboard → Apps & Credentials → Your App
- Scroll to Webhooks
- Click on your webhook
- Check Event Log or recent deliveries
- Should show HTTP 200 status (success)
Test Content Access:
- In the same browser (logged in as subscriber)
- Visit the protected post
- 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:
- Developer Dashboard → Testing Tools → Webhooks
- Select your webhook
- Choose an event type
- Click Send Test
- Check your server isn't blocking PayPal IPs
Subscription Not Activating After Payment
This is always a webhook issue. Check:
- Webhook ID matches the one in PaywallWP settings
- Webhook events are being received (check event log)
- Enable
WP_DEBUG_LOGand check/wp-content/debug.log - 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
| Purpose | URL |
|---|---|
| Developer Dashboard | https://developer.paypal.com/dashboard/ |
| Sandbox Accounts | https://developer.paypal.com/dashboard/accounts |
| Apps & Credentials | https://developer.paypal.com/dashboard/applications/sandbox |
| Sandbox PayPal Login | https://www.sandbox.paypal.com/ |
| Webhook Simulator | https://developer.paypal.com/dashboard/webhooksSimulator |
Next Steps
You've completed PayPal sandbox setup!
- Ready for real payments? → PayPal Live Mode Setup
- Want Stripe too? → Stripe Test Mode Setup
- Configure content protection → Content Protection Guide