4.6 KiB
4.6 KiB
PayPal Payment Flow - Quick Debug Reference
Quick Commands
View recent errors:
cd /home/runner/work/GSP/GSP/modules/billing/logs
# Last 50 lines of create order log
tail -50 paypal_create_order.log
# Last 50 lines of capture log
tail -50 paypal_capture.log
# Last 50 lines of client errors
tail -50 client_errors.log
Watch logs live:
# In terminal, run:
tail -f /home/runner/work/GSP/GSP/modules/billing/logs/paypal_*.log
Search for specific error:
# Find all OAuth errors
grep "OAUTH.*ERROR" paypal_create_order.log paypal_capture.log
# Find database errors
grep "DB.*FAILED" paypal_capture.log
# Find a specific request by ID
grep "req_12345" paypal_create_order.log
Common Error Patterns
❌ "JSON error" or "unable to handle this request"
What to check:
- Browser console (F12 → Console tab) for JavaScript errors
client_errors.logfor client-side issuespaypal_create_order.logforJSON_DECODE_ERROR
Quick fix:
- Check if cart items are valid
- Verify amount calculations are correct
- Look for PHP errors that might corrupt JSON output
❌ HTTP ERROR 500
What to check:
paypal_create_order.logforCREATE_ORDER_HTTP_ERRORpaypal_capture.logforCAPTURE_HTTP_ERROR- Look for
OAUTH.*ERRORentries
Quick fix:
- Verify PayPal credentials are correct
- Check PayPal API status: https://www.paypal-status.com/
- Verify sandbox vs live mode settings match credentials
❌ Payment seems successful but no order created
What to check:
paypal_capture.logforDB_CONNECTION_FAILED- Look for
UPDATE_INVOICES_FAILED - Check
ORDER_CREATE_FAILED
Quick fix:
- Verify database connection settings
- Check if
ogp_billing_invoicestable exists - Verify
ogp_billing_orderstable exists - Check table permissions
❌ Intermittent failures (works sometimes, fails sometimes)
What to check:
- Compare successful vs failed requests in logs
- Look for timeout errors (
CURL.*ERROR) - Check for database connection pool exhaustion
Quick fix:
- Check server load/resources
- Verify network connectivity to PayPal API
- Check for rate limiting
Log File Locations
/home/runner/work/GSP/GSP/modules/billing/logs/
├── paypal_create_order.log # Order creation (when clicking "Pay")
├── paypal_capture.log # Payment capture (after PayPal approval)
└── client_errors.log # JavaScript/browser errors
Request ID Format
- Create order:
req_XXXXXXXXXXXXX - Capture order:
cap_XXXXXXXXXXXXX
When user sees an error with (Ref: req_abc123), search logs for that ID.
Important Log Labels
Create Order Flow:
REQUEST_START→RAW_INPUT→PARSED_INPUTOAUTH_REQUEST_START→OAUTH_SUCCESSCREATE_ORDER_REQUEST_START→CREATE_ORDER_SUCCESS
Capture Order Flow:
REQUEST_START→PARSED_INPUTOAUTH_SUCCESS→CAPTURE_SUCCESSDB_CONNECTED→PROCESSING_INVOICESORDER_CREATED_SUCCESSorORDER_EXTENDED_SUCCESS
Error Labels:
*_ERROR- Something went wrong*_FAILED- Operation failedINVALID_*- Invalid input/data
Browser Console Debugging
- Open cart page
- Press F12 to open DevTools
- Go to Console tab
- Click "Pay with PayPal"
- Watch for:
- Red error messages
PayPal Error:logs- Network errors (check Network tab)
Testing Checklist
When testing payments:
- Check browser console for errors
- Note the Ref ID if error occurs
- Check
paypal_create_order.logfor the request - Check
paypal_capture.logif got past order creation - Verify database tables exist and have data
- Check PayPal sandbox account activity
Need More Help?
See full guide: PAYPAL_DEBUGGING_GUIDE.md
Key Configuration Files
-
PayPal credentials:
api/create_order.phpandapi/capture_order.php- Lines 5-6:
$client_idand$client_secret - Line 4:
$sandbox(true/false)
- Lines 5-6:
-
Database config:
includes/config.inc.php$db_host,$db_user,$db_pass,$db_name$table_prefix
Status Checklist for Issues
When user reports error:
-
Get details:
- What error message did they see?
- What was the Ref ID (if shown)?
- Can they reproduce it?
-
Check logs:
- Find the request by Ref ID
- Look for ERROR or FAILED labels
- Check surrounding context (before/after)
-
Verify config:
- PayPal credentials valid?
- Database connection working?
- Correct sandbox/live mode?
-
Test:
- Try creating test order
- Watch logs in real-time
- Check database for created records