Registry / payments / paypalrestsdk

paypalrestsdk

JSON →
library1.13.3pypypi✓ verified 22d ago

The `paypalrestsdk` library provides Python APIs to integrate with PayPal's REST APIs for creating, processing, and managing payments. This library is officially deprecated and is no longer actively maintained. The last public version is 1.13.3, released in November 2023, and no new features or support are provided.

pip install paypalrestsdk
INSTALL
IMPORT
SIG · PAYPALRESTSDK
P
paypalrestsdk
paymentspythonv1.13.3
Install
3.2s avg
Import
456ms
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.13.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.476s · 39MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.2s · import 0.436s · 39MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

paypalrestsdk
import paypalrestsdk
Payment
from paypalrestsdk import Payment
Tokeninfo
from paypalrestsdk.openid_connect import Tokeninfo

This quickstart demonstrates how to configure the `paypalrestsdk` and create a basic PayPal payment. It assumes `PAYPAL_MODE`, `PAYPAL_CLIENT_ID`, and `PAYPAL_CLIENT_SECRET` are set as environment variables. Note that this SDK is deprecated.

import os import paypalrestsdk paypalrestsdk.configure({ "mode": os.environ.get("PAYPAL_MODE", "sandbox"), # "sandbox" or "live" "client_id": os.environ.get("PAYPAL_CLIENT_ID", ""), "client_secret": os.environ.get("PAYPAL_CLIENT_SECRET", "") }) # Example: Create a simple payment (requires valid client_id and client_secret in sandbox/live) payment = paypalrestsdk.Payment({ "intent": "sale", "payer": { "payment_method": "paypal" }, "redirect_urls": { "return_url": "http://localhost:8000/payment/execute", "cancel_url": "http://localhost:8000/payment/cancel" }, "transactions": [{ "item_list": { "items": [{ "name": "item", "sku": "item", "price": "1.00", "currency": "USD", "quantity": 1 }] }, "amount": { "total": "1.00", "currency": "USD" }, "description": "This is the payment transaction description." }] }) if payment.create(): print(f"Payment created successfully: {payment.id}") for link in payment.links: if link.rel == "approval_url": print(f"Approval URL: {link.href}") else: print(f"Error creating payment: {payment.error}")
Debug
Known issues
breakingThe `paypalrestsdk` Python SDK is officially deprecated. PayPal is transitioning deprecated server-side SDKs to private, restricted access. Public GitHub repository access for this SDK will be restricted after April 29th (likely 2024), making it unavailable for new integrations or easy access to source code and issues.
fix
Migrate to newer PayPal API integrations. PayPal recommends using newer SDKs (e.g., v2/Checkout SDKs) or directly integrating with PayPal's REST APIs. For direct credit card payments, Braintree Direct is the preferred solution.
affects: All versions, specifically from April 29th, 2024 onwards.
deprecatedThis library is no longer supported or receiving new features/security updates. Using it in new projects is strongly discouraged.
fix
Transition to current PayPal API integration methods as outlined in PayPal Developer documentation.
affects: All versions (since official deprecation).
gotchaDue to PCI compliance requirements, your server must support TLS 1.2 for all HTTPS connections to PayPal. Older TLS versions will result in connection warnings or failures.
fix
Ensure your server environment and Python's underlying SSL/TLS libraries are updated to support TLS 1.2 and HTTP/1.1.
affects: All versions operating on environments not compliant with TLS 1.2.
gotchaPayPal REST API no longer supports *new* direct credit card integrations. If your application requires direct credit card processing, consider using Braintree Direct, a PayPal service.
fix
For new direct credit card integrations, use Braintree Direct or other recommended PayPal solutions.
affects: New integrations.
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'paypalrestsdk'
The 'paypalrestsdk' module is not installed in the Python environment.
fix
Install the module using pip: 'pip install paypalrestsdk'.
AttributeError: module 'paypalrestsdk' has no attribute 'Payment'
The 'Payment' class is not found in the 'paypalrestsdk' module, possibly due to incorrect import or module version issues.
fix
Ensure you are using the correct version of 'paypalrestsdk' and that the 'Payment' class is available in that version.
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
The SSL certificate verification failed, possibly due to outdated certificates or incorrect system time.
fix
Update your system's CA certificates and ensure the system time is correct.
paypalrestsdk.exceptions.ConnectionError: Failed to establish a new connection
The SDK is unable to connect to PayPal's servers, possibly due to network issues or incorrect API endpoint configuration.
fix
Check your network connection and verify that the API endpoint is correctly configured.
paypalrestsdk.exceptions.UnauthorizedAccess: Authentication failed due to invalid API credentials
The provided API credentials (client ID and secret) are incorrect or do not match the environment (sandbox or live).
fix
Verify that the client ID and secret are correct and correspond to the intended environment.
Upgrade
Version history
1.13.3latest on PyPI · released Nov 1, 2023
Audit
Dependencies
libssl-devrequiredSystem library required for SSL/TLS communication.
libffi-devrequiredSystem library required for foreign function interface, likely for cryptographic operations.
Agent activity
24 hits · last 30 days
node
20
Resources
paypalrestsdk — pip install paypalrestsdk · libregistry