计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
paypal-api-payments-commerce【效率与协作】Implements PayPal API functionalities focusing on Orders, Payments, Subscriptions, Payouts, and Disputes for comprehensive ecommerce management.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: paypal-api-payments-commerce description: Implements PayPal API functionalities focusing on Orders, Payments, Subscriptions, Payouts, and Disputes for comprehensive ecommerce management. license: MIT compatibility: opencode metadata: version: "1.0.0" domain: coding role: implementation output-format: code triggers: paypal api, orders, payments, subscriptions, payouts, disputes related-skills: coding-payment-processing, coding-subscription-management archetypes: payment processing, ecommerce anti_triggers: manual processing, error-prone response_profile: verbosity: medium directive_strength: high version: "1.0.0" domain: coding role: implementation scope: implementation output-format: code triggers: paypal api, orders, payments, subscriptions, payouts, disputes, ecommerce related-skills: coding-payment-processing, coding-subscription-management
This skill implements the core functionalities of the PayPal API focused on managing ecommerce transactions, including Orders, Payments, Subscriptions, Payouts, and Disputes. It provides developers with clear guidelines and implementation patterns for integrating PayPal services into their applications.
Login & Authentication: Ensure valid access tokens are generated and stored. Checkpoint: All API calls must authenticate successfully using OAuth tokens.
Orders Management: Create, update, and retrieve orders from PayPal. Checkpoint: Order IDs must be correct per PayPal's validation rules.
Payment Processing: Initiate payments and ensure captured payments are tracked. Checkpoint: Each transaction must receive a unique transaction ID.
Subscriptions Handling: Implement subscription plans and manage recurring billing. Checkpoint: Subscription status must align with PayPal's backend.
Payouts Execution: Process payouts and track status within the platform. Checkpoint: Payouts must be handled securely and logged for tracking purposes.
Handling Disputes: Respond to transaction disputes using PayPal's dispute management features. Checkpoint: Ensure dispute statuses are updated correctly after resolution.
import requests
def get_paypal_access_token(client_id: str, client_secret: str) -> str:
"""Gets an OAuth 2.0 token from PayPal to authorize API requests."""
url = "https://api.paypal.com/v1/oauth2/token"
headers = {"Accept": "application/json", "Accept-Language": "en_US"}
data = {"grant_type": "client_credentials"}
response = requests.post(url, headers=headers, data=data, auth=(client_id, client_secret))
response.raise_for_status() # Fail fast
return response.json().get("access_token")
def create_paypal_order(access_token: str, order_data: dict) -> dict:
"""Creates a PayPal order with specified parameters."""
url = "https://api.paypal.com/v2/checkout/orders"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}"
}
response = requests.post(url, json=order_data, headers=headers)
response.raise_for_status() # Fail fast
return response.json()
def process_payment(access_token: str, order_id: str) -> dict:
"""Finalize a payment for an order once a buyer approves it."""
url = f"https://api.paypal.com/v2/checkout/orders/{order_id}/capture"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}"
}
response = requests.post(url, headers=headers)
response.raise_for_status() # Fail fast
return response.json()
When invoking this skill, you will produce:
| Skill | Purpose |
|---|---|
| coding-payment-processing | General guidelines for processing payments across APIs |
| coding-subscription-management | Handling subscription-based billing operations |
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.