
Paypal Integration
Wire PayPal Checkout (OAuth, order creation, capture) into your backend when you are adding payments to a SaaS or store.
Overview
paypal-integration is an agent skill for the Build phase that guides server-side PayPal Checkout order creation and OAuth access with worked API patterns.
Install
npx skills add https://github.com/wshobson/agents --skill paypal-integrationWhat is this skill?
- PayPalClient pattern with sandbox vs production api-m hosts
- OAuth client-credentials flow for v1/oauth2/token access tokens
- v2/checkout/orders creation with CAPTURE intent and purchase_units amounts
- Python requests-based examples for server-side Express Checkout setup
- Currency and string-formatted amount fields in order payloads
- PayPal REST v2 checkout/orders with CAPTURE intent pattern
Adoption & trust: 6.8k installs on skills.sh; 36.5k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need to accept PayPal in your product but are unsure about token retrieval, sandbox URLs, and v2 order JSON for capture flows.
Who is it for?
Indie SaaS and ecommerce backends adding PayPal alongside card or wallet checkout using REST and Python or similar HTTP stacks.
Skip if: Stripe-only stacks, no-code storefronts without custom backend code, or teams needing full Braintree vault and subscription matrices in one skill.
When should I use this skill?
When implementing or debugging PayPal server-side checkout, OAuth tokens, or order creation in backend code.
What do I get? / Deliverables
Your agent can scaffold a backend client that authenticates to PayPal and creates CAPTURE-intent orders you can hook to front-end approval and capture steps.
- PayPal OAuth token helper
- Order creation payload and client stub
- Sandbox vs production base URL configuration
Recommended Skills
Journey fit
Payment provider integration is core product engineering once you have something to sell, which maps to the build phase backend shelf. Server-side order creation, tokens, and REST calls are backend integration work, not distribution or analytics.
How it compares
Skill package with copy-paste API patterns, not a hosted MCP payment server or PayPal’s official SDK docs replacement.
Common Questions / FAQ
Who is paypal-integration for?
Solo builders and indie backends wiring PayPal REST Checkout into custom apps with agent-assisted coding.
When should I use paypal-integration?
During build/backend when implementing checkout, capturing payments server-side, or prototyping sandbox orders before launch pricing goes live.
Is paypal-integration safe to install?
It describes live payment APIs and secrets handling; review the Security Audits panel on this page and never paste production credentials into chat logs.
SKILL.md
READMESKILL.md - Paypal Integration
# paypal-integration — detailed patterns and worked examples ## Express Checkout Implementation ### Server-Side Order Creation ```python import requests import json class PayPalClient: def __init__(self, client_id, client_secret, mode='sandbox'): self.client_id = client_id self.client_secret = client_secret self.base_url = 'https://api-m.sandbox.paypal.com' if mode == 'sandbox' else 'https://api-m.paypal.com' self.access_token = self.get_access_token() def get_access_token(self): """Get OAuth access token.""" url = f"{self.base_url}/v1/oauth2/token" headers = {"Accept": "application/json", "Accept-Language": "en_US"} response = requests.post( url, headers=headers, data={"grant_type": "client_credentials"}, auth=(self.client_id, self.client_secret) ) return response.json()['access_token'] def create_order(self, amount, currency='USD'): """Create a PayPal order.""" url = f"{self.base_url}/v2/checkout/orders" headers = { "Content-Type": "application/json", "Authorization": f"Bearer {self.access_token}" } payload = { "intent": "CAPTURE", "purchase_units": [{ "amount": { "currency_code": currency, "value": str(amount) } }] } response = requests.post(url, headers=headers, json=payload) return response.json() def capture_order(self, order_id): """Capture payment for an order.""" url = f"{self.base_url}/v2/checkout/orders/{order_id}/capture" headers = { "Content-Type": "application/json", "Authorization": f"Bearer {self.access_token}" } response = requests.post(url, headers=headers) return response.json() def get_order_details(self, order_id): """Get order details.""" url = f"{self.base_url}/v2/checkout/orders/{order_id}" headers = { "Authorization": f"Bearer {self.access_token}" } response = requests.get(url, headers=headers) return response.json() ``` ## IPN (Instant Payment Notification) Handling ### IPN Verification and Processing ```python from flask import Flask, request import requests from urllib.parse import parse_qs app = Flask(__name__) @app.route('/ipn', methods=['POST']) def handle_ipn(): """Handle PayPal IPN notifications.""" # Get IPN message ipn_data = request.form.to_dict() # Verify IPN with PayPal if not verify_ipn(ipn_data): return 'IPN verification failed', 400 # Process IPN based on transaction type payment_status = ipn_data.get('payment_status') txn_type = ipn_data.get('txn_type') if payment_status == 'Completed': handle_payment_completed(ipn_data) elif payment_status == 'Refunded': handle_refund(ipn_data) elif payment_status == 'Reversed': handle_chargeback(ipn_data) return 'IPN processed', 200 def verify_ipn(ipn_data): """Verify IPN message authenticity.""" # Add 'cmd' parameter verify_data = ipn_data.copy() verify_data['cmd'] = '_notify-validate' # Send back to PayPal for verification paypal_url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr' # or production URL response = requests.post(paypal_url, data=verify_data) return response.text == 'VERIFIED' def handle_payment_completed(ipn_data): """Process completed payment.""" txn_id = ipn_data.get('txn_id') payer_email = ipn_data.get('payer_email') mc_gross = ipn_data.get('mc_gross') item_name = ipn_data.get('item_name') # Check if already processed (prevent duplicates) if is_transaction_processed(txn_id): return # Update database # Send confirmation email # Fulfill order print(f"Payment completed: {tx