Checkout
Set Shipping Info
Sets customer shipping information and calculate shipping costs
POST
Set Shipping Info
Overview
Sets customer shipping information for cart delivery. This endpoint validates the address, calculates shipping costs based on available shipping methods, and updates cart totals. This endpoint supports multi-shipment scenarios where different items may ship from different locations.Both
POST and PUT methods are supported for this endpoint, providing flexibility for different client implementations.Request Body
Customer’s first name
Customer’s last name
Primary address line (street address)
Secondary address line (apartment, suite, unit, etc.)
City name
State or province code (e.g., “CA”, “NY”) or full name
ZIP or postal code
Country code in ISO 3166-1 alpha-2 format (e.g., “US”, “CA”)
Contact phone number for delivery
Contact email address
Response
Returns a complete ShoppingCart object with:- Updated shipping information
- Calculated shipping costs per shipment
- Updated tax calculations based on shipping address
- Recalculated cart totals
Multi-Shipment Behavior
The shipping address applies to all shipments in the cart. Key behaviors:- Address Application: The provided address is used for all shipments
- Shipping Calculation: Each shipment’s shipping cost is calculated independently
- Tax Calculation: Taxes are recalculated based on the shipping destination
- Validation: Address is validated against merchant’s supported regions
Code Examples
Response Example
Address Validation
The endpoint performs several validations:- Country Support: Verifies the country is supported by the merchant
- State/Province: Validates state/province code for the given country
- Required Fields: Ensures all required fields are provided
- Email Format: Validates email address format
- Postal Code: Basic format validation for the country
Shipping Calculation Process
- Address Validation: Verify address is valid and supported
- Shipping Methods: Retrieve available shipping methods for the destination
- Cost Calculation: Calculate shipping cost for each shipment
- Tax Recalculation: Update taxes based on shipping destination
- Total Update: Recalculate cart totals with shipping and tax
Error Responses
Common Errors
| Error Code | Description | Resolution |
|---|---|---|
ErrorCartNotFound | Cart does not exist | Verify cart ID and domain |
ErrorNoLineItem | Cart is empty | Add items before setting shipping |
ErrorShippingNotNeeded | Cart contains only digital items | Skip shipping for digital-only carts |
ErrorCountryNotSupported | Country not supported by merchant | Use supported country |
ErrorInvalidState | Invalid state/province for country | Verify state code |
ErrorInvalidEmail | Invalid email format | Provide valid email address |
ErrorInvalidShippingInfo | Shipping info validation failed | Check all required fields |
ErrorInvalidInputBody | Request body validation failed | Verify request format |
ErrorStoreUnavailable | Store service unavailable | Retry request |
Related Operations
After setting shipping information, typical next steps include:- Set Billing Info - Add billing address
- Set Consents - Update consent preferences
- Complete Order - Complete the purchase
Set Shipping Info