Use this file to discover all available pages before exploring further.
To enable AI agents to create and manage shopping carts through your store, integrate with PayPal’s Cart API. This guide shows you how to implement the 3 core endpoints that handle cart creation, updates, and checkout completion, including PayPal Orders API v2 integration for payment processing.
To create a new shopping cart with specified items, use POST /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.
To update an existing cart by replacing its contents with the provided data, use PUT /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.
To complete the checkout process for a cart, use POST /merchant-cart/{id}/checkout. This endpoint finalizes the purchase by processing the payment using the specified payment method.
POST /api/paypal/v1/merchant-cart/CART-123/checkoutContent-Type: application/jsonAuthorization: Bearer <paypal-jwt-token>{ "payment_method": { "type": "paypal", "token": "EC-7U8939823K567", //PayPal Orders V2 ID "payer_id": "PAYER123456789" //PayPal User Identifier }}
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.
To use our Postman resources, you can download our Postman collection. This collection includes example requests for the Cart API endpoints, which you can use as a reference when building your API.