Paypal Integration

作者 wshobson46891e7e60da无许可证收录于 2026年10月8日更新于 2026年10月8日

Integrate PayPal payment processing with support for express checkout, subscriptions, and refund management. Use when implementing PayPal payments, processing online transactions, or building e-commerce checkout flows.

AI 生成的概览

指导开发者集成 PayPal 支付,涵盖快捷结账、订阅、IPN 网络钩子和退款。

功能
该技能为在应用中集成 PayPal 提供指导和代码示例。内容涵盖 PayPal Checkout、Subscriptions 和 Payouts,客户端 JavaScript SDK 按钮与服务端 REST API 流程,IPN 通知处理,以及退款和争议工作流。它还包含使用沙箱凭据和测试账户的测试指导。
适用场景
适用于将 PayPal 添加为支付选项、构建快捷结账流程、设置定期扣款或订阅、处理退款和争议,或处理 PayPal IPN 网络钩子。也适用于国际支付支持和平台打款场景。
运行要求
需要 PayPal API 凭据(客户端 ID 和密钥)以及访问 PayPal 服务的网络连接。示例中引用了 paypalrestsdk Python 包和 PayPal JavaScript SDK。该技能不附带脚本,仅为说明文档,更多模式见 references/details.md。

PayPal Integration

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

When to Use This Skill

  • 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

javascript
// Frontend - PayPal Smart Buttons<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&currency=USD"></script><script>  paypal.Buttons({    createOrder: function(data, actions) {      return actions.order.create({        purchase_units: [{          amount: {            value: '25.00'          }        }]      });    },    onApprove: function(data, actions) {      return actions.order.capture().then(function(details) {        // Payment successful        console.log('Transaction completed by ' + details.payer.name.given_name);
        // Send to backend for verification        fetch('/api/paypal/capture', {          method: 'POST',          headers: {'Content-Type': 'application/json'},          body: JSON.stringify({orderID: data.orderID})        });      });    }  }).render('#paypal-button-container');</script>
python
# Backend - Verify and capture orderfrom paypalrestsdk import Paymentimport paypalrestsdk
paypalrestsdk.configure({    "mode": "sandbox",  # or "live"    "client_id": "YOUR_CLIENT_ID",    "client_secret": "YOUR_CLIENT_SECRET"})
def capture_paypal_order(order_id):    """Capture a PayPal order."""    payment = Payment.find(order_id)
    if payment.execute({"payer_id": payment.payer.payer_info.payer_id}):        # Payment successful        return {            'status': 'success',            'transaction_id': payment.id,            'amount': payment.transactions[0].amount.total        }    else:        # Payment failed        return {            'status': 'failed',            'error': payment.error        }

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Testing

python
# Use sandbox credentialsSANDBOX_CLIENT_ID = "..."SANDBOX_SECRET = "..."
# Test accounts# Create test buyer and seller accounts at developer.paypal.com
def test_payment_flow():    """Test complete payment flow."""    client = PayPalClient(SANDBOX_CLIENT_ID, SANDBOX_SECRET, mode='sandbox')
    # Create order    order = client.create_order(10.00)    assert 'id' in order
    # Get approval URL    approval_url = next((link['href'] for link in order['links'] if link['rel'] == 'approve'), None)    assert approval_url is not None
    # After approval (manual step with test account)    # Capture order    # captured = client.capture_order(order['id'])    # assert captured['status'] == 'COMPLETED'

来源与署名

来源:wshobson/agents位于plugins/payment-processing/skills/paypal-integration提交46891e7

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架