Configuring Fees
The fees feature in Carts API allows you to add, update, or remove additional fees beyond the resource price, such as gifting fees, platform fees, and service fees. These fees can be applied at various levels, including the cart, individual items, or fulfillment, providing flexibility in customizing the total cost structure. Optionally, the fees may be taxable.
Prerequisites
The following prerequisites must be completed sequentially to configure a fee.
- Create a cart.
- Create a fulfillment to apply the fulfillment fee.
- Create an item to add the item fee.
Fee Initialization
You can apply fees at multiple levels, including the cart, individual items, or fulfillment. The fee resource maintains a consistent structure across all levels. Taxes on fees is controlled by the taxable
attribute in the request payload, which defaults to true
. This means fees are taxed unless specifically set to false
.
The following code sample provides the structure of a fee object:
Click to expand the JSON example.
Click to expand the JSON example.
The resource is displayed as a collection of fees for the associated resource as multiple fees can be applied to a single resource.
The following code sample provides the structure of a fee object in a collection:
Click to expand the JSON example.
Click to expand the JSON example.
Examples
Adding shipping fees, including shipping fee tax
The following steps outline how a fulfillment fee is configured:
-
Click to expand the curl example.
-
Add tax for the fulfillment fee using the replace tax data endpoint.
Click to expand the curl and JSON response examples
Tax here includes fulfillment tax and fulfillment the fee tax as provided in the payload.
Response:
Applying a gifting fee to items that are gift-wrapped
Use the create item fees endpoint to apply the gifting fees to the items that are gift wrapped. The following curl example provides how the request is structured when creating an item fee:
Click to expand the curl example.
Click to expand the curl example.
Adding a platform fee at the cart level
Use the create cart fees endpoint to add a platform fee at the cart level. The following curl example provides how the request is structured when creating fee at the cart level:
Click to expand the curl example.
Click to expand the curl example.