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 here.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 merchant ID and permissions.
- Security verification: Verify token signature using PayPal’s public keys. 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 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 credentialsmerchant_id, tokenization_key. More information can be found here.
Braintree Integration Flow
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 is an example request payload.Important: PayPal will use your Braintree credentials to internally 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 with pass a Braintree nonce which you can then create a transaction from.