PayPal Payment Process API

Secure Core PHP API · Server handles PayPal first · Then forwards to your return_url / cancel_url

Open Orders Admin

Flow
  1. Call create API with X-API-Key, merchant_reference, return_url
  2. Redirect customer to checkout_url → PayPal
  3. PayPal returns to this server (return / cancel / IPN)
  4. Server logs + updates DB, then forwards same info to your return_url with payment_status=success|failed (or cancel_url)

Security

All API endpoints require header: X-API-Key: YOUR_KEY (set in config/app.php)

1. Create payment

POST https://jeraldine-predominant-heather.ngrok-free.dev/projects/paypal-payment-process/api/create-payment.php

curl -X POST https://jeraldine-predominant-heather.ngrok-free.dev/projects/paypal-payment-process/api/create-payment.php \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
  "amount": 10.50,
  "item_name": "Invoice Payment",
  "merchant_reference": "ORD-1001",
  "email": "customer@example.com",
  "return_url": "https://yoursite.com/payment-result",
  "cancel_url": "https://yoursite.com/payment-cancel"
}'

2. Get order by merchant_reference

GET https://jeraldine-predominant-heather.ngrok-free.dev/projects/paypal-payment-process/api/payment-status.php?merchant_reference=ORD-1001

curl "https://jeraldine-predominant-heather.ngrok-free.dev/projects/paypal-payment-process/api/payment-status.php?merchant_reference=ORD-1001" \
  -H "X-API-Key: YOUR_API_KEY"

3. What your return_url receives

Query params after our server processing, including:

Show proper success/fail UI on your site from these params.