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 從公開儲存庫中收錄這些內容。

檢舉或申請下架