sickn33/antigravity-awesome-skills/paypal-integration

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Master PayPal payment integration including Express Checkout, IPN handling, recurring billing, and refund workflows.

Install

npx vskill@latest install sickn33/antigravity-awesome-skills/paypal-integration

SKILL.md

Supporting material availability

The following are external prerequisites, not bundled files: <support-root>/references/express-checkout.md, <support-root>/references/ipn-handling.md, <support-root>/references/refund-workflows.md, <support-root>/references/billing-agreements.md, <support-root>/assets/paypal-client.py, <support-root>/assets/ipn-processor.py, <support-root>/assets/recurring-billing.py. Obtain them from the original source or an existing installation and inspect them before use. Do not execute or claim completion of a dependent step until its required file exists; report unavailable steps. The fully documented inline workflow remains usable within the authorized scope.

PayPal Integration

Master PayPal payment integration including Express Checkout, IPN handling, recurring billing, and refund workflows.

Do not use this skill when

  • The task is unrelated to paypal integration
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

Use this skill when

  • Integrating PayPal as a payment option
  • Implementing express checkout flows
  • Setting up recurring billing with PayPal
  • Processing refunds and payment disputes
  • Handling PayPal webhooks (IPN)
  • Supporting international payments
  • Implementing PayPal subscriptions

Core Concepts

1. Payment Products

PayPal Checkout

  • One-time payments
  • Express checkout experience
  • Guest and PayPal account payments

PayPal Subscriptions

  • Recurring billing
  • Subscription plans
  • Automatic renewals

PayPal Payouts

  • Send money to multiple recipients
  • Marketplace and platform payments
2. Integration Methods

Client-Side (JavaScript SDK)

  • Smart Payment Buttons
  • Hosted payment flow
  • Minimal backend code

Server-Side (REST API)

  • Full control over payment flow
  • Custom checkout UI
  • Advanced features
3. IPN (Instant Payment Notification)
  • Webhook-like payment notifications
  • Asynchronous payment updates
  • Verification required

Quick Start

Use the current JavaScript SDK with Orders v2 endpoints on your authenticated backend. Do not combine browser-side capture with a second backend capture, and do not pass Orders v2 IDs to the legacy Payments v1 SDK.

javascript
// Browser fragment; include the SDK with the public client ID, never the client secret.
paypal.Buttons({
async createOrder() {
const response = await fetch('/api/paypal/orders', {method: 'POST'});
if (!response.ok) throw new Error('Order creation failed');
return (await response.json()).id;
},
async onApprove(data) {
const response = await fetch('/api/paypal/capture', {
method: 'POST', headers: {'Content-Type': 'application/json'},
body: JSON.stringify({orderID: data.orderID})
});
if (!response.ok) throw new Error('Capture confirmation failed');
// Backend owns reconciliation/fulfilment; the browser callback is not payment evidence.
}
}).render('#paypal-button-container');

The route handlers are application adapters, not bundled. They must authenticate the user, enforce CSRF/origin controls, bind the order to the owned cart, derive price/currency/payee from trusted data, persist a stable PayPal-Request-Id per operation, and verify capture status/amount/currency/payee before atomic fulfilment. Treat timeout as uncertain; reconcile the existing request rather than create another charge. Store secrets through the server environment/secret manager. Use Decimal/string amounts with currency-specific precision, never binary floats for money. The following fragments are sandbox examples, not a production payment system.

Express Checkout Implementation

Server-Side Order Creation
python
import requests
import json
class PayPalClient:
def __init__(self, client_id, client_secret, mode='sandbox'):
if mode not in ('sandbox', 'live'):
raise ValueError('Explicit sandbox or live mode required')
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), timeout=15, allow_redirects=False
)
response.raise_for_status()
return response.json()['access_token']
def create_order(self, amount, request_id, currency='USD'):
"""Create a PayPal order."""
url = f"{self.base_url}/v2/checkout/orders"
headers = {
"Content-Type": "application/json",
"PayPal-Request-Id": request_id, # Persisted per operation, unchanged on retry.
"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, timeout=15, allow_redirects=False)
response.raise_for_status()
return response.json()
def capture_order(self, order_id, request_id):
"""Capture payment for an order."""
url = f"{self.base_url}/v2/checkout/orders/{order_id}/capture"
headers = {
"Content-Type": "application/json",
"PayPal-Request-Id": request_id, # Persisted per operation, unchanged on retry.
"Authorization": f"Bearer {self.access_token}"
}
response = requests.post(url, headers=headers, timeout=15, allow_redirects=False)
response.raise_for_status()
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, timeout=15, allow_redirects=False)
response.raise_for_status()
return response.json()

IPN (Instant Payment Notification) Handling

IPN is a legacy notification protocol, not the REST Webhooks API. For current REST integrations verify webhook signatures with the documented webhook ID and environment. Limit inbound request size. VERIFIED establishes origin only: validate receiver, currency, amount, owned invoice/order and transaction status, then deduplicate atomically with a unique event/transaction record. A check-then-act helper alone races. Process reversals/refunds against original records and acknowledge only after durable recording.

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
raw_ipn = request.get_data(cache=True)
ipn_data = request.form.to_dict()
# Verify IPN with PayPal
if not verify_ipn(raw_ipn):
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(raw_ipn):
"""Echo original encoded body in order; do not reconstruct it from a dict."""
paypal_url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'
response = requests.post(paypal_url, data=b'cmd=_notify-validate&' + raw_ipn,
headers={'Content-Type': 'application/x-www-form-urlencoded'},
timeout=15, allow_redirects=False)
response.raise_for_status()
return response.text.strip() == '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: {txn_id}, Amount: ${mc_gross}")
def handle_refund(ipn_data):
"""Handle refund."""
parent_txn_id = ipn_data.get('parent_txn_id')
mc_gross = ipn_data.get('mc_gross')
# Process refund in your system
print(f"Refund processed: {parent_txn_id}, Amount: ${mc_gross}")
def handle_chargeback(ipn_data):
"""Handle payment reversal/chargeback."""
txn_id = ipn_data.get('txn_id')
reason_code = ipn_data.get('reason_code')
# Handle chargeback
print(f"Chargeback: {txn_id}, Reason: {reason_code}")

Mutation examples require a persisted operation-specific PayPal-Request-Id where supported, immutable server-owned amounts and opaque validated resource IDs. Token expiry/refresh, verified merchant identity and durable event processing are required integration work; no fragment implements fulfilment by itself. Refunds and recurring charges require authorization for that exact operation.

Subscription/Recurring Billing

Create Subscription Plan
python
def create_subscription_plan(name, amount, request_id, interval='MONTH'):
"""Create a subscription plan."""
client = PayPalClient(CLIENT_ID, CLIENT_SECRET)
url = f"{client.base_url}/v1/billing/plans"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {client.access_token}",
"PayPal-Request-Id": request_id
}
payload = {
"product_id": "PRODUCT_ID", # Create product first
"name": name,
"billing_cycles": [{
"frequency": {
"interval_unit": interval,
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 1,
"total_cycles": 0, # Infinite
"pricing_scheme": {
"fixed_price": {
"value": str(amount),
"currency_code": "USD"
}
}
}],
"payment_preferences": {
"auto_bill_outstanding": True,
"setup_fee": {
"value": "0",
"currency_code": "USD"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
}
}
response = requests.post(url, headers=headers, json=payload, timeout=15, allow_redirects=False)
response.raise_for_status()
return response.json()
def create_subscription(plan_id, subscriber_email, request_id):
"""Create a subscription for a customer."""
client = PayPalClient(CLIENT_ID, CLIENT_SECRET)
url = f"{client.base_url}/v1/billing/subscriptions"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {client.access_token}",
"PayPal-Request-Id": request_id
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
27,444
Repository forks
4,626
Repository npm downloads, 7 days
6,951
7-day trend score
72

Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 22 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sickn33/antigravity-awesome-skills/paypal-integration/badge)](https://verified-skill.com/skills/sickn33/antigravity-awesome-skills/paypal-integration)

Something wrong with this skill or its page? Tell us.