PayPal Checkout Server SDK
The `paypal-checkout-serversdk` Python library is **deprecated** as of its last release (1.0.3 on October 24, 2023). PayPal has transitioned this and other older server-side SDKs to private/restricted access on GitHub, meaning they are no longer actively maintained or supported. For new integrations or migrating existing ones, PayPal recommends using the `paypal-server-sdk` Python library or integrating directly with the PayPal REST APIs.
Warnings
- breaking The `paypal-checkout-serversdk` library is officially **deprecated** and no longer maintained. Its GitHub repository has been removed or transitioned to private access, meaning no further bug fixes, security updates, or new features will be provided. Continued use may lead to compatibility issues or security vulnerabilities.
- deprecated PayPal ceased support and feature development for this SDK. Its last release was 1.0.3 on October 24, 2023, with a clear 'Deprecated' status on PyPI.
- gotcha There are multiple PayPal Python SDKs, and it's easy to confuse them. `paypal-checkout-serversdk` is deprecated, as is the much older `paypalrestsdk`. The currently recommended official Python SDK is `paypal-server-sdk`. Ensure you are using the correct, supported library.
- gotcha GitHub repository access for deprecated PayPal server-side SDKs, including this one, has been restricted. This means you may encounter issues with CI/CD pipelines or local development if they rely on direct GitHub access to the old repositories.
Install
-
pip install paypal-checkout-serversdk -
pip install paypal-server-sdk
Imports
- PayPalHttpClient, SandboxEnvironment, OrdersCreateRequest
from paypal_serversdk_client import PaypalServersdkClient, ClientCredentialsAuthCredentials, Environment
Quickstart
import os
import logging
from paypal_serversdk_client import PaypalServersdkClient, ClientCredentialsAuthCredentials, Environment, LoggingConfiguration
# NOTE: This quickstart is for the recommended replacement 'paypal-server-sdk',
# as 'paypal-checkout-serversdk' is deprecated and should not be used.
# Get credentials from environment variables for security
client_id = os.environ.get('PAYPAL_CLIENT_ID', 'YOUR_PAYPAL_CLIENT_ID')
client_secret = os.environ.get('PAYPAL_CLIENT_SECRET', 'YOUR_PAYPAL_CLIENT_SECRET')
if not client_id or not client_secret:
print("WARNING: PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET not found in environment variables.")
print("Please set them or replace placeholders for actual API calls.")
# Configure logging for the SDK (optional, but good practice)
logging_config = LoggingConfiguration(log_level=logging.INFO)
# Initialize the API client for the Sandbox environment
# For production, use Environment.LIVE
try:
client = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id=client_id,
o_auth_client_secret=client_secret
),
environment=Environment.SANDBOX, # Or Environment.LIVE for production
logging_configuration=logging_config
)
print("PayPal Server SDK client initialized successfully (Sandbox environment).")
print("You can now use 'client' to make API calls, e.g., client.orders_controller.create_order(...)")
except Exception as e:
print(f"Error initializing PayPal Server SDK client: {e}")