PayPal Setup Guide¶
This guide covers setting up PayPal for both testing (sandbox) and production environments, specifically for subscription payments and webhooks.
Sandbox Environment Setup¶
1. Create Developer Accounts¶
- Go to PayPal Developer Dashboard
- Create two sandbox accounts:
- Business account (to receive payments)
- Personal account (to make test payments)
2. Create Sandbox App¶
- In Developer Dashboard, go to "Apps & Credentials"
- Click "Create App"
- Select "Sandbox" for testing environment
- Name your application (e.g., "Not Alone Test")
- Note down:
- Client ID
- Client Secret
3. Create Subscription Plans¶
- Navigate to "Products & Plans"
- Create a product:
- Create subscription plan(s):
- Set billing cycle (use daily for testing)
- Set price points
- Note down Plan ID for each plan
4. Configure Webhooks¶
- Go to "Webhooks" in Developer Dashboard
- Click "Add Webhook"
- Enter your webhook URL:
- Subscribe to these events:
- BILLING.SUBSCRIPTION.ACTIVATED
- BILLING.SUBSCRIPTION.CANCELLED
- BILLING.SUBSCRIPTION.EXPIRED
- BILLING.SUBSCRIPTION.UPDATED
- PAYMENT.SALE.COMPLETED
- Save and note down the Webhook ID
Production Environment Setup¶
1. Business Account Setup¶
- Create or use existing PayPal Business account
- Ensure your business account is verified and in good standing
2. Create Live App¶
- Go to PayPal Developer Dashboard
- Click "Create App"
- Select "Live" for production environment
- Name your application (e.g., "Not Alone")
- Note down:
- Client ID
- Client Secret
3. Create Live Subscription Plans¶
- Navigate to "Products & Plans"
- Create your product:
- Create subscription plan(s):
- Set actual billing cycle (monthly/yearly)
- Set real price points
- Note down Plan ID for each plan
4. Configure Live Webhooks¶
- Go to "Webhooks" in Developer Dashboard
- Click "Add Webhook"
- Enter your production webhook URL:
- Subscribe to these events:
- BILLING.SUBSCRIPTION.ACTIVATED
- BILLING.SUBSCRIPTION.CANCELLED
- BILLING.SUBSCRIPTION.EXPIRED
- BILLING.SUBSCRIPTION.UPDATED
- PAYMENT.SALE.COMPLETED
- Save and note down the Webhook ID
Testing¶
Sandbox Testing Checklist¶
-
Test subscription creation:
- Use sandbox personal account to subscribe
- Verify webhook notification
- Check subscription status in business account
-
Test subscription cancellation:
- Cancel subscription from personal account
- Verify webhook notification
- Check status update in business account
-
Test subscription updates:
- Modify subscription if your plans allow it
- Verify webhook notification
- Confirm changes in both accounts
-
Test recurring payment processing:
- Confirm successful payment capture
- Verify PAYMENT.SALE.COMPLETED webhook
- Check payment appears in business account
Production Verification¶
Before going live:
- Verify all webhook endpoints are correctly configured
- Test a small real transaction
- Confirm subscription plans are correctly priced
- Verify all PayPal buttons are using production credentials