Note: You can view the complete protocol reference for the Cart API and the Complete Checkout API.
API endpoints
The Cart API provides 3 core endpoints that handle the complete cart lifecycle. Each endpoint serves a specific purpose in the agentic shopping flow. To view the PayPal Cart schema, visit the API specification page.POST /merchant-cartcreates a new cart.PUT /merchant-cart/{id}updates an existing cart.POST /merchant-cart/{id}/checkoutcompletes the checkout process.
Authentication with PayPal-supplied JWTs
- Request authentication: Every API call includes the token in the authorization header.
- Merchant identification: Tokens contain your PayPal merchant ID and permissions.
- Security verification: Verify the token signature using PayPal’s public keys. For more information, see Verify token.
Receive token in the authorization header
Every API request must include the PayPal-supplied JWT in the authorization header.Verify token
- Parse the authorization header:
"Bearer \<token\>". - Verify token signature using the PayPal public key.
- Validate the token expiration.
Create a cart
To create a new shopping cart with specified items, usePOST /merchant-cart. The cart also can include customer information, such as a shipping address and payment method to use.
Cart creation
This example of a request payload shows how to structure a cart creation request with items and customer information.Important: Within this endpoint, a merchant is expected to implement Orders API v2 integration. For more information about this, see Cart creation with an order
Update a cart
To update an existing cart by replacing its contents with the provided data, usePUT /merchant-cart/{id}. With this endpoint, you can add or remove items, change quantities, update the shipping address, apply discounts, and so on.
Important: PUT replaces the entire cart. It removes or resets any fields that you do not include in your request. This is a complete replacement operation, not a merge.
Include all current cart data when you make changes, as shown in the following example.
Important: Within this endpoint, a merchant is expected to implement Orders API v2 integration. For more information about this, see Cart update with an order update.
Complete checkout
To complete the checkout process for a cart, usePOST /merchant-cart/{id}/checkout. This endpoint finalizes the purchase by processing the payment using the specified payment method.
Important: Within this endpoint, a merchant is expected to implement Orders API v2 integration. For more information about this, see Cart completed with an order captured.
PayPal Orders API integration pattern
Behind the scenes, the PayPal Cart API integrates with PayPal’s Orders API v2 to manage payment tokens and process transactions. Understanding this relationship helps you implement proper payment handling. The following table explains when to create (POST) or update (PATCH) a cart.
| Scenario | PayPal Orders Action | Reason |
|---|---|---|
| Initial cart creation. | POST /v2/orders | Create a new payment context. |
| Add or remove items. | PATCH /v2/orders/{id} | Update totals. |
| Apply or remove coupons. | PATCH /v2/orders/{id} | Update totals. |
| Update shipping address. | PATCH /v2/orders/{id} | Update shipping and tax. |
| Change quantities. | PATCH /v2/orders/{id} | Update totals. |
| Create a fresh payment context when a payment token expires. | POST /v2/orders | Create a fresh payment context. |
| Create a new cart after checkout. | POST /v2/orders | Prepare for a new transaction. |
| Capture an order. | POST /v2/checkout/orders/{id}/capture | Capture the payment for an order. |