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.POST /merchant-cartcreates a new cart.PUT /merchant-cart/{id}updates an existing cart.POST /merchant-cart/{id}/checkoutcompletes the checkout process.
Tip: You can view the PayPal Cart schema here.
Authentication with PayPal-supplied JWTs
- Request authentication: Every API call includes the token in the authorization header.
- Merchant identification: Tokens contain your merchant ID and permissions.
- Security verification: Verify token signature using PayPal’s public keys. See Verify the token.
Receive token in the authorization header
Every API request must include the PayPal-supplied JWT in the authorization header.Verify the 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.
This example of a request payload shows how to structure a cart creation request with items and customer information.
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 making 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. When implementing the Cart API, merchants must integrate with PayPal Orders API v2 to handle payment tokens and order updates. The following table explains when to create (POST) or update (PATCH) a cart.
| Scenario | PayPal Orders Action | Reason |
|---|---|---|
| Create a cart. | 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 the 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. |