Published: November 12, 2026. Last updated: November 22, 2026.
The PayPal API allows developers to integrate payment processing, checkout, subscriptions, invoicing, refunds, payouts, and other financial operations into websites and applications. PayPal provides REST APIs that use OAuth 2.0 authentication, HTTPS requests, and JSON responses to communicate with its payment platform.
To start using the PayPal REST API, create an application in the PayPal Developer Dashboard, obtain your Client ID and Client Secret, generate an OAuth access token, and make requests to the appropriate API endpoints. You can test transactions in the PayPal Sandbox before switching to live payments.
This guide explains the major PayPal APIs, how authentication works, how to create and capture payment orders, and how to handle webhooks, errors, and production deployment securely.
What is the PayPal API?
The PayPal API is a collection of programming interfaces that allows applications to interact with supported PayPal services without requiring a merchant to perform every operation manually.
For example, an e-commerce application can use the PayPal Orders API to create a checkout order, allow the buyer to approve payment, and capture the funds. The application can then use PayPal webhooks to receive payment-status notifications and update its order records.
PayPal’s modern REST APIs use standard HTTP methods, including GET, POST, and PATCH. Requests generally send and receive JSON data, and protected endpoints require an OAuth 2.0 bearer access token.
PayPal offers multiple API collections rather than a single universal payment endpoint. Each collection handles a particular category of financial operations.
What can you do with the PayPal API?
PayPal provides APIs for processing purchases, managing recurring payments, sending invoices, issuing refunds, and automating other business workflows.
| API | Primary purpose | Typical use case |
|---|---|---|
| Orders API v2 | Create, retrieve, update, authorize, and capture checkout orders | Online store checkout |
| Payments API v2 | Manage payment authorizations, captures, and refunds | Refunding a completed purchase |
| Subscriptions API | Manage supported recurring billing arrangements | Membership or subscription payments |
| Invoicing API | Create, send, update, and track invoices | Automated client billing |
| Payouts API | Send eligible disbursements to recipients | Contractor or affiliate payouts |
| Webhooks API | Subscribe to and manage event notifications | Updating orders after payment events |
| Disputes API | Access and manage supported payment disputes | Merchant dispute management |
| Transaction Search API | Retrieve eligible account transaction records | Payment reporting and reconciliation |
| Catalog Products API | Create and manage product records for supported billing workflows | Subscription product management |
The right API depends on the action your application needs to perform. A website accepting a one-time payment typically begins with the Orders API, while a subscription service may also need the Catalog Products and Subscriptions APIs.
PayPal maintains the complete list of supported resources in its current REST API documentation.
PayPal REST API vs. JavaScript SDK: What’s the difference?
The PayPal REST API and JavaScript SDK work together in many web payment integrations, but they serve different purposes.
| Tool | What it does | Where it runs |
|---|---|---|
| REST API | Creates orders, captures payments, processes refunds, and manages payment resources | Typically the application backend |
| JavaScript SDK | Displays eligible payment interfaces and manages supported buyer checkout interactions | Customer’s browser |
| Server SDK | Provides supported language-specific tools for using PayPal APIs | Application backend |
| PayPal Payment Buttons | Provides merchant-configured payment buttons without custom API development | Merchant website and PayPal-hosted checkout |
In a custom checkout integration, the JavaScript SDK can display the payment interface while the backend uses the Orders API to create and capture payment orders.
For a simple website selling a fixed-price service, a generated PayPal payment button may be sufficient. For an application that controls inventory, shipping, order records, and payment status, a server-side API integration provides greater flexibility.
How to get PayPal API credentials
Before making authenticated API requests, you need credentials associated with a PayPal developer application.
PayPal provides separate Sandbox and Live environments. Each environment uses its own credentials.
Step 1: Open the PayPal Developer Dashboard
Visit developer.paypal.com and sign in to the Developer Dashboard.
PayPal allows developers to test US integrations using a developer account. Its official getting-started documentation states that a PayPal Business account is required to go live with integrations or test integrations outside the United States.
Step 2: Open Apps & Credentials
In the Developer Dashboard, select Apps & Credentials.
New developer accounts normally include a default REST API application. You can use the existing application or select Create App to create a separate application for your project.
Select the Sandbox environment while developing and testing. Live credentials are used only when the application is ready to process real payments.
Step 3: Find your Client ID and Client Secret
Open the application’s credentials and locate its Client ID and Client Secret.

| Credential | Purpose | Security requirement |
|---|---|---|
| Client ID | Identifies your PayPal application | May be used in the browser where officially supported |
| Client Secret | Authenticates your application when requesting access | Must remain confidential on the server |
| OAuth Access Token | Authorizes requests to protected REST API endpoints | Protect as a bearer credential and renew after expiration |
The Client ID and Client Secret are not interchangeable. The Client Secret is used to authenticate the application when obtaining an access token, while the access token is used to authorize subsequent REST API requests.
Never place a Client Secret in browser JavaScript, public repositories, or downloadable frontend files.
PayPal provides the account and application setup process in its REST API getting-started guide.
How PayPal API authentication works
PayPal REST APIs use OAuth 2.0 access tokens to authorize requests.
For a standard server-to-server integration, your application exchanges its Client ID and Client Secret for an access token using the OAuth client credentials flow.
That token is then included in the Authorization header when calling protected PayPal REST endpoints.
Get a Sandbox access token with cURL
In a local shell or secure server environment, set the environment variables PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET to the credentials from your Sandbox application.
With those variables available, use the following cURL request:
curl --request POST \
--url "https://api-m.sandbox.paypal.com/v1/oauth2/token" \
--user "$PAYPAL_CLIENT_ID:$PAYPAL_CLIENT_SECRET" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=client_credentials"
The --user option supplies the Client ID and Client Secret using HTTP Basic authentication. The request body specifies the OAuth client credentials grant.
A successful response contains fields including access_token, token_type, and expires_in.
The access_token value authorizes subsequent API requests. The expires_in value indicates the token’s validity period in seconds.
Access tokens are temporary. A production backend should cache them securely, track their expiration, and request replacements when needed.
For the next example, store the token returned by PayPal in a secure shell environment variable named PAYPAL_ACCESS_TOKEN. Avoid printing tokens to public logs or exposing them to browser code.
How to make a PayPal REST API request
PayPal REST API requests use one of two base URLs, depending on the environment.
| Environment | API base URL | Purpose |
|---|---|---|
| Sandbox | https://api-m.sandbox.paypal.com | Testing with simulated accounts and funds |
| Live | https://api-m.paypal.com | Production transactions with real accounts |
An authenticated REST API request generally contains an HTTP method, a resource URL, an authorization header, and any JSON data required for the operation.
Example: Create a PayPal Sandbox order
The Orders API v2 creates checkout orders. The following request creates a test order for USD 10.00 with a CAPTURE intent.
It uses the Sandbox access token obtained through the OAuth authentication process.
curl --request POST \
--url "https://api-m.sandbox.paypal.com/v2/checkout/orders" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $PAYPAL_ACCESS_TOKEN" \
--data '{
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "10.00"
}
}
]
}'
The request specifies the payment intent, currency, and order amount. In a real checkout application, the backend must calculate the amount from trusted order information rather than accepting an arbitrary amount supplied by the browser.
If PayPal accepts the request, it returns an order resource containing an order ID, status information, and relevant links for the payment flow.
Creating an order does not charge the customer. The buyer must complete the required approval process before the merchant can capture payment in a standard PayPal Checkout flow.
The official Orders API integration guide explains how to complete that lifecycle.
Understanding PayPal Orders API v2
The Orders API v2 is central to PayPal’s standard checkout integration. It allows merchants to create orders, obtain buyer approval, and complete the appropriate payment action.
For a typical one-time online purchase, the payment process follows these steps:
- Start checkout. The customer selects PayPal as a payment option on the merchant’s website.
- Create the order. The merchant’s backend calculates the amount and submits an Orders API request.
- Receive the order ID. PayPal returns a resource that identifies the newly created order.
- Obtain buyer approval. The customer reviews the PayPal payment experience and approves the payment.
- Capture or authorize. The merchant performs the server-side action appropriate to the order’s intent.
- Verify the result. The merchant checks the payment status, amount, currency, and transaction identity.
- Update the order. The application records the payment outcome and fulfills the purchase only when the required payment conditions are satisfied.

Important Orders API endpoints
| Operation | HTTP method | Endpoint |
|---|---|---|
| Create order | POST | /v2/checkout/orders |
| Retrieve order | GET | /v2/checkout/orders/{id} |
| Update eligible order fields | PATCH | /v2/checkout/orders/{id} |
| Capture approved order | POST | /v2/checkout/orders/{id}/capture |
| Authorize approved order | POST | /v2/checkout/orders/{id}/authorize |
In these endpoint paths, {id} identifies the actual PayPal order being managed. Applications obtain this identifier from a successful order creation or lookup operation.
CAPTURE vs. AUTHORIZE: Which intent should you use?
PayPal supports different payment collection workflows.
CAPTURE is appropriate when a merchant intends to collect payment after the customer approves the checkout. This is common for online purchases where payment is collected during the ordering process.
AUTHORIZE is used when a merchant needs to authorize funds before capturing them later. For example, a retailer may authorize a payment while confirming inventory and capture the funds before shipping the order.
An authorization is not the same as a completed capture. The merchant must perform the subsequent capture within PayPal’s applicable authorization period and conditions.
PayPal’s Orders API documentation describes an authorization period of 29 days, with additional rules governing the timing of the capture.
PayPal JavaScript SDK v6 for website checkout
The PayPal JavaScript SDK provides browser-side payment components that developers can integrate into websites.
PayPal’s JavaScript SDK v6 is the recommended version for new web integrations. It supports eligible payment experiences including PayPal, Pay Later, Venmo in the United States, credit and debit cards, Apple Pay, Google Pay, and Fastlane.
The supported payment methods depend on the merchant, buyer, device, product configuration, and location. Not every integration can display every payment option.
SDK v6 script URLs
PayPal documents the following JavaScript SDK v6 core URLs:
Production: https://www.paypal.com/web-sdk/v6/core
Sandbox: https://www.sandbox.paypal.com/web-sdk/v6/core
After loading the SDK, a standard v6 integration initializes an SDK instance using window.paypal.createInstance() with the appropriate configuration and components.
For most standard checkout integrations, PayPal recommends client ID authentication. Fastlane uses a separate client-token authentication flow.
The SDK can manage buyer-facing payment interactions, but the merchant backend remains responsible for creating trusted orders, completing the appropriate API operations, and verifying payment status.
Why older SDK v5 examples may not work with v6
Many older PayPal tutorials load JavaScript SDK v5 using a script URL containing a client-id query parameter and initialize payment buttons with paypal.Buttons().
JavaScript SDK v6 uses a different component-based design and initialization model. Code written for SDK v5 should not be inserted unchanged into a v6 integration.

Developers working with existing installations can consult PayPal’s SDK v5-to-v6 upgrade guide. For new implementations, use the current JavaScript SDK v6 setup documentation and its linked sample integration.
How to refund payments using PayPal API
After a transaction has been captured, developers can use the Payments API v2 to manage eligible refunds.
To refund a captured payment, your application needs the capture ID associated with the original transaction.
The relevant endpoint is:
POST /v2/payments/captures/{capture_id}/refund
PayPal supports full and partial refunds through this endpoint. For a full refund, the documented request uses an empty JSON body. For a partial refund, the request includes an appropriate amount object.
Before submitting a refund, the backend should identify the original capture, verify the refund amount, and check its own refund records to avoid unintended duplicate actions.
If a payment has only been authorized and has not yet been captured, voiding the eligible authorization is a different operation from refunding a completed capture.
For implementation details, see PayPal’s Refund Captured Payment API reference.
How PayPal webhooks work
PayPal webhooks notify an application when selected payment-related events occur. They are particularly important for keeping a merchant’s order records synchronized with payment activity.
Instead of relying entirely on an immediate API response or a customer returning to the website, your backend can receive an event notification when PayPal reports a relevant state change.
Important PayPal checkout webhook events
| Webhook event | Meaning | Application response |
|---|---|---|
CHECKOUT.ORDER.APPROVED | The buyer approved the order | Proceed with the appropriate capture flow when required |
PAYMENT.CAPTURE.COMPLETED | The payment capture completed | Verify the payment and update the order as paid |
PAYMENT.CAPTURE.PENDING | The payment capture remains pending | Keep the order awaiting completion |
PAYMENT.CAPTURE.DENIED | The payment capture was denied | Do not fulfill the order as paid |
CHECKOUT.PAYMENT-APPROVAL.REVERSED | Approval was reversed before successful capture | Handle the unsuccessful payment and notify the buyer where appropriate |
Event availability and handling requirements depend on the payment method and integration. A completed capture should be matched against the expected merchant order, amount, currency, and capture identifier before fulfillment.
How to set up a webhook listener
A PayPal webhook integration typically follows these steps:
- Create an HTTPS endpoint on your server to receive notifications.
- Register the endpoint in the relevant PayPal application or through the Webhooks Management API.
- Subscribe to the payment events your application needs.
- Record the webhook ID associated with the subscription.
- Verify the authenticity of incoming webhook messages.
- Validate the event and associated payment information.
- Update local records without processing the same event more than once.
- Return an appropriate HTTP success response after the notification has been safely accepted.

PayPal requires webhook listeners to be reachable through HTTPS on port 443. If PayPal cannot successfully deliver an event, it may retry delivery up to 25 times over three days.
Verifying webhook signatures
Receiving an HTTP request that claims to come from PayPal is not sufficient proof that it is authentic.
PayPal supports cryptographic signature verification and an API-based verification method that submits the relevant webhook message and transmission headers back to PayPal for verification.
Your application should verify the webhook before trusting its payment status or triggering fulfillment.
PayPal also provides a webhook simulator for testing listener behavior. Simulated webhook events are mock messages and cannot be verified through PayPal’s postback signature verification endpoint. The simulator supports its documented self-verification approach for mock notifications.
See the webhook integration guide and webhook simulator documentation for the supported verification and testing procedures.
Testing PayPal API with Sandbox
The PayPal Sandbox is a testing environment that simulates PayPal transactions without moving real money.
Sandbox testing lets developers validate authentication, order creation, buyer approval, capture, error handling, and payment notifications before using live merchant accounts.
Sandbox Business and Personal accounts
A typical Sandbox checkout requires two account roles:
- Business Sandbox account: Represents the merchant receiving the payment.
- Personal Sandbox account: Represents the buyer approving and making the payment.

PayPal normally creates default Business and Personal Sandbox accounts for developer accounts.
You can view or create test accounts by opening Testing Tools → Sandbox Accounts in the Developer Dashboard.
The account details include simulated account information used to sign in to the Sandbox environment.
A practical Sandbox testing sequence
- Configure your backend with Sandbox API credentials.
- Request an OAuth access token.
- Create a test order using the Orders API.
- Use the supported checkout flow to approve the order with a Personal Sandbox account.
- Capture or authorize the payment according to the selected intent.
- Inspect the returned payment status and identifiers.
- Verify that the local order record reflects the correct payment outcome.
- Test cancellations, unsuccessful payments, pending states, and duplicate notifications.
Sandbox responses help validate integration behavior, but successful testing does not guarantee that every live account, payment method, or transaction will qualify for production use.
PayPal’s Sandbox Accounts documentation explains how to manage test buyers and merchants.
Preventing duplicate PayPal API transactions
Network interruptions can create uncertainty about whether an API operation succeeded. For payment processing, retrying the same action without checking its status can risk duplicate operations.
PayPal supports an idempotency mechanism using the PayPal-Request-Id header on supported API operations.
An idempotency identifier is a unique value associated with one logical operation. When the same supported request is retried using the same identifier, PayPal can recognize the duplicate within the applicable retention period rather than performing the operation again.
For example, if a merchant submits a refund request and the network times out before the response arrives, the application should determine whether the original refund succeeded. For an endpoint supporting idempotency, retrying with the original request identifier can help prevent a duplicate refund.
The retention period and supported behavior depend on the endpoint. PayPal documents retention periods of up to 45 days for certain operations, but this should not be assumed for every request.
Use a stable identifier for retries of the same logical action and a different identifier for a genuinely new action. Keep your own payment and request records because idempotency is not a replacement for transaction reconciliation.
PayPal explains this behavior in its API request header documentation.
Common PayPal API errors and how to fix them
PayPal API responses use HTTP status codes and structured error information. Checking both the HTTP status and response body is essential for understanding failures.
| HTTP status | Common meaning | What to check |
|---|---|---|
400 Bad Request | Invalid request format or parameters | JSON syntax, missing fields, supported values, and required headers |
401 Unauthorized | Authentication failed | Access token, token expiration, and Sandbox/Live credential mismatch |
403 Forbidden | Application or account lacks permission | Required scopes, merchant eligibility, and product access |
404 Not Found | Requested resource was not found | Endpoint, resource identifier, account, and API environment |
422 Unprocessable Entity | Request conflicts with business or payment rules | Payment state, currency, amount, and detailed error information |
500 Internal Server Error | PayPal encountered a server error | Check service status and original transaction state before retrying safely |
Why am I getting a PayPal API 401 error?
A 401 Unauthorized response commonly indicates that the request is missing valid authentication information or that the bearer token has expired.
Verify that the access token was generated using credentials from the correct application and environment. A Sandbox access token should not be used with the Live API host.
If the token has expired, request a new token using the OAuth token endpoint.
What does UNPROCESSABLE_ENTITY mean?
An UNPROCESSABLE_ENTITY error generally indicates that the request cannot be processed under the applicable business rules, even though its format may be valid.
Examples include incompatible order states, invalid transaction amounts, unsupported payment conditions, or a payment instrument that cannot be used.
Check the detailed issue information instead of automatically resubmitting the same request.
How to use PayPal’s debug_id
PayPal error responses can include a debug_id value that helps identify a failed request for troubleshooting.
Record the debug identifier alongside the request’s endpoint, time, HTTP status, and relevant non-sensitive transaction information.
This information can help developers investigate errors or communicate with PayPal support without exposing private credentials or payment information.
More details are available in PayPal’s API response handling guide and common errors documentation.
PayPal API security best practices
Payment APIs handle financially sensitive operations. A reliable PayPal integration requires server-side validation, credential protection, and careful processing of payment outcomes.
- Protect Client Secrets. Store confidential credentials in secure server-side configuration or secrets management systems.
- Use HTTPS. Protect communication between browsers, merchant servers, and payment services with appropriately configured secure connections.
- Validate order totals on the server. Never rely solely on prices or quantities supplied by client-side JavaScript.
- Verify capture status. Treat buyer approval, authorization, pending payment, and completed capture as different states.
- Authenticate webhooks. Verify incoming event messages before using them to update payment records.
- Prevent duplicate processing. Use supported idempotency headers and maintain consistent transaction records.
- Restrict access. Protect refund, capture, payout, and other financially sensitive backend endpoints with appropriate authorization.
- Handle errors safely. Log useful diagnostic information without exposing tokens, secrets, or sensitive customer data.
- Separate environments. Keep Sandbox and Live credentials, endpoints, and webhook configurations distinct.
Using PayPal does not automatically make an entire website or custom payment integration PCI DSS compliant. Compliance responsibilities depend on the payment integration, the data handled, and applicable requirements.
For additional security guidance, consult the PayPal Developer Security Guidelines.
How to move PayPal API from Sandbox to Live
After validating your integration in Sandbox, you can prepare the application to process real transactions.
Going live involves more than changing the API hostname. Your merchant account must meet the relevant requirements, and your application must use the correct production configuration.
- Verify your merchant account. Complete applicable PayPal Business account requirements and obtain access to the payment products your integration uses.
- Obtain Live credentials. Open the relevant application in the Developer Dashboard and access its production Client ID and Client Secret.
- Configure production API calls. Use
https://api-m.paypal.comfor Live REST API requests. - Configure the production SDK. Load the current production JavaScript SDK and use the correct Live application configuration.
- Register Live webhooks. Configure the production listener and record the corresponding webhook ID.
- Verify transaction handling. Ensure the backend correctly handles completed, pending, denied, canceled, and reversed payment states.
- Monitor production activity. Review API errors, transaction records, notification delivery, and payment reconciliation.
Sandbox applications and credentials are separate from Live applications. Credentials from one environment cannot be assumed to work in the other.
For production requirements and account verification, follow the official PayPal production deployment documentation.
Is the PayPal API free?
PayPal provides access to its developer documentation, API development tools, and Sandbox testing environment without charging a separate fee simply to read the documentation or perform simulated test transactions.
However, processing real payments through PayPal generally involves transaction fees. Costs depend on the payment product, merchant location, currency, and transaction type.
For example, PayPal’s published US merchant schedule lists a standard domestic PayPal Checkout rate of 3.49% plus $0.49 when payment is received in US dollars.
At that rate, a qualifying $100 domestic PayPal Checkout transaction has a processing fee of $3.98, leaving $96.02 before any other applicable charges.
Other services, such as advanced card processing, payouts, international commercial transactions, and currency conversions, may follow different pricing rules.
API access should not be confused with the fees charged for the financial transactions processed through an API.
See the official PayPal US Merchant Fees for current rates and applicable conditions.
Frequently asked questions about PayPal API
Does PayPal API require a Business account?
PayPal allows developers to test US integrations with a developer account. According to its official getting-started documentation, a Business account is required to move integrations to production or test integrations outside the United States. Specific API products may also have additional merchant eligibility or approval requirements.
Is a PayPal Client ID the same as an API key?
Developers sometimes refer to PayPal application credentials as API keys, but PayPal REST authentication typically uses a Client ID and Client Secret to obtain an OAuth 2.0 access token. The Client ID identifies the application, while the Client Secret must remain confidential.
Can I use PayPal API with Python or Node.js?
Yes. PayPal REST APIs communicate over HTTPS using standard requests and JSON, making them accessible from Python, Node.js, and other languages with HTTP client support. PayPal also provides supported server SDKs. Developers should check the relevant SDK’s current version and API compatibility before using it.
Can PayPal API handle recurring subscriptions?
Yes. PayPal provides subscription-related APIs for creating supported subscription plans and managing recurring billing arrangements. The Subscriptions API is separate from the ordinary one-time Orders API workflow, and eligible subscription products may have additional requirements.
Can PayPal API send payments to multiple recipients?
PayPal offers a Payouts API for eligible disbursement workflows, including payments to multiple recipients. Access, supported markets, and permissions depend on the merchant’s eligibility and the applicable Payouts product requirements.
Can I capture a PayPal order immediately after creating it?
In a standard PayPal Checkout flow, creating an order does not itself authorize or capture the payment. The buyer must complete the required approval step before the server captures an order using the ordinary Orders API capture flow. Other eligible payment products can support different processing patterns.
Where can I find the official PayPal API documentation?
The official PayPal API documentation is available through the PayPal Developer Portal. It provides REST API references, authentication instructions, integration guides, SDK documentation, Sandbox testing resources, and webhook information.
Official PayPal API documentation and resources
The integration guidance in this article is based on PayPal’s official REST API, JavaScript SDK, Sandbox, and webhook documentation.
- Get Started with PayPal REST APIs — application credentials, OAuth authentication, and Sandbox setup.
- Current PayPal REST API Resources — supported API collections and their purposes.
- REST API Authentication — OAuth 2.0 tokens and authentication requests.
- Orders API v2 Integration — payment creation, buyer approval, authorization, and capture.
- JavaScript SDK v6 Setup — current web SDK configuration and payment components.
- PayPal Webhooks Integration — event subscriptions, delivery, and signature verification.
- Sandbox Accounts — test merchant and buyer account management.
- API Response Handling — HTTP status codes, errors, and troubleshooting.
- Production Deployment — Live credentials and production configuration.
- Official PayPal REST API Specifications — API descriptions and OpenAPI resources for developers.
For a new payment integration, the most practical starting point is to obtain Sandbox credentials, authenticate with OAuth 2.0, create an order through Orders API v2, and complete a buyer-approved test payment. Once the basic flow works, secure payment capture, webhook verification, retry handling, and production configuration become essential parts of a reliable integration.