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 Authorization header:
"Bearer \<token\>". - Verify token signature using the PayPal public key.
- Validate the token expiration.
Braintree credentials
To enable agentic checkout, we will need your Braintree credentials:merchant_id and tokenization_key. For more information, see Important gateway credentials.
Create a cart
To create a new shopping cart with specified items, usePOST /merchant-cart. The cart can also 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: PayPal uses your Braintree credentials to create a token. You do not need to return a token here.
Update a cart
To update an existing cart by replacing its contents with the provided data, usePUT /merchant-cart/{id}. Use this endpoint to 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.
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, PayPal passes a Braintree nonce, which you can then use to create a transaction.