{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/tools/cart-calculation","auth":"optional","examples":{"codes":[]},"method":"post","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Cart Calculation","type":"endpoint","slug":"cart-calculation","excerpt":"","body":"The Cart Calculation request enables you to perform updates to the checkout price prior to completing a transaction. This request is useful when your shopper has added a coupon and you want to provide the updated total immediately for your shopper. Other possible use cases for this service are when you need to display the impact of tax or shipping to your shoppers. \n \n###Request Content\n`cart-info` <span style=\"color:#F37500\">**required**</span>, contains the following properties (see [cart-info](doc:cart-info)):\n `cart-params` *container* <span style=\"color:#F37500\">**required**</span> (see [cart-params](doc:cart-params))\n `cart` *container* <span style=\"color:#F37500\">**required**</span> (see [cart](doc:cart))\n `sku` *container* <span style=\"color:#F37500\">**required**</span> (see [sku](doc:sku))\n `coupons` *integer* optional\n\n###Response Details\nIf successful, the response HTTP status code is 200 OK.\n\n<hr>\n\n##Examples\n\n###Request Examples\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n\\n<cart-info xmlns=\\\"http://ws.plimus.com\\\">\\n<cart-params>\\n<currency>USD</currency>\\n</cart-params>\\n<cart>\\n<cart-item>\\n<sku>\\n<sku-id>2180434</sku-id>\\n</sku>\\n<quantity>1</quantity>\\n</cart-item>\\n<coupons>\\n<coupon>ccv20</coupon>\\n</coupons>\\n</cart>\\n</cart-info>\",\n \"language\": \"xml\",\n \"name\": \"Cart calculation with coupons\"\n },\n {\n \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n\\n<cart-info xmlns=\\\"http://ws.plimus.com\\\">\\n<cart-params>\\n<currency>USD</currency>\\n<country>US</country>\\n<state>CA</state>\\n</cart-params>\\n<cart>\\n<cart-item>\\n<sku>\\n<sku-id>2176834</sku-id>\\n</sku>\\n<quantity>1</quantity>\\n</cart-item>\\n</cart>\\n</cart-info>\\n\",\n \"language\": \"xml\",\n \"name\": \"Cart calculation with tax\"\n }\n ]\n}\n[/block]\n###Response Examples\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<cart-info xmlns=\\\"http://ws.plimus.com\\\">\\n<cart>\\n<charged-currency>USD</charged-currency>\\n<cart-item>\\n<sku>\\n<sku-id>2180434</sku-id>\\n</sku>\\n<quantity>1</quantity>\\n<item-sub-total>20.00</item-sub-total>\\n<item-coupon-total>10.00</item-coupon-total>\\n<item-total>10.00</item-total>\\n</cart-item>\\n<coupons>\\n<coupons-total>10.00</coupons-total>\\n</coupons>\\n<tax>0.00</tax>\\n<tax-rate>0</tax-rate>\\n<total-cart-cost>10.00</total-cart-cost>\\n</cart>\\n</cart-info>'\",\n \"language\": \"xml\",\n \"name\": \"Response with coupon amounts\"\n },\n {\n \"code\": \"<!-- NOTE: Actual taxes may differ from this example -->\\n\\n<!-- Response begins below -->\\n<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\\n<cart-info xmlns=\\\"http://ws.plimus.com\\\">\\n<cart>\\n<charged-currency>USD</charged-currency>\\n<cart-item>\\n<sku>\\n<sku-id>2176834</sku-id>\\n</sku>\\n<quantity>1</quantity>\\n<item-sub-total>49.99</item-sub-total>\\n<item-coupon-total>0.00</item-coupon-total>\\n<item-total>49.99</item-total>\\n</cart-item>\\n<coupons>\\n<coupons-total>0.00</coupons-total>\\n</coupons>\\n<tax>4.12</tax>\\n<tax-rate>8.25</tax-rate>\\n<total-cart-cost>54.11</total-cart-cost>\\n</cart>\\n</cart-info>\",\n \"language\": \"xml\",\n \"name\": \"Response with tax \"\n }\n ]\n}\n[/block]","updates":[],"order":3,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"61a5033cd3c4d201e7b583c9","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Orders","slug":"topics","order":1,"from_sync":false,"reference":true,"_id":"61a5033cd3c4d201e7b583bb","version":"61a5033cd3c4d201e7b5848b","project":"57336fd5a6a9c40e00e13a0b","createdAt":"2015-11-03T20:45:01.593Z","__v":0},"parentDoc":null,"project":"57336fd5a6a9c40e00e13a0b","user":"560d5913af97231900938124","version":{"version":"8976-Extended","version_clean":"8976.0.0-Extended","codename":"3.40 Release","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["61a5033cd3c4d201e7b583ba","61a5033cd3c4d201e7b583bb","61a5033cd3c4d201e7b583bc","61a5033cd3c4d201e7b583bd","61a5033cd3c4d201e7b583be","61a5033cd3c4d201e7b583bf","61a5033cd3c4d201e7b583c0","61a5033cd3c4d201e7b583c1","61a5033cd3c4d201e7b583c2","61a5033cd3c4d201e7b583c3","61a5033cd3c4d201e7b583c4"],"_id":"61a5033cd3c4d201e7b5848b","project":"57336fd5a6a9c40e00e13a0b","__v":0,"forked_from":"6040037678d626005641a154","createdAt":"2018-04-24T15:33:45.744Z","releaseDate":"2018-04-24T15:33:45.744Z"},"createdAt":"2016-12-09T19:12:35.090Z","githubsync":"","__v":0}
postCart Calculation
Definition
Documentation
The Cart Calculation request enables you to perform updates to the checkout price prior to completing a transaction. This request is useful when your shopper has added a coupon and you want to provide the updated total immediately for your shopper. Other possible use cases for this service are when you need to display the impact of tax or shipping to your shoppers.
Request Content
cart-info
required, contains the following properties (see cart-info):
cart-params
container required (see cart-params)
cart
container required (see cart)
sku
container required (see sku)
coupons
integer optional
Response Details
If successful, the response HTTP status code is 200 OK.
Examples
Request Examples
curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<cart-info xmlns="http://ws.plimus.com">
<cart-params>
<currency>USD</currency>
</cart-params>
<cart>
<cart-item>
<sku>
<sku-id>2180434</sku-id>
</sku>
<quantity>1</quantity>
</cart-item>
<coupons>
<coupon>ccv20</coupon>
</coupons>
</cart>
</cart-info>
curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<cart-info xmlns="http://ws.plimus.com">
<cart-params>
<currency>USD</currency>
<country>US</country>
<state>CA</state>
</cart-params>
<cart>
<cart-item>
<sku>
<sku-id>2176834</sku-id>
</sku>
<quantity>1</quantity>
</cart-item>
</cart>
</cart-info>
curl -v -X POST https://sandbox.bluesnap.com/services/2/tools/cart-calculation \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<cart-info xmlns="http://ws.plimus.com">
<cart>
<charged-currency>USD</charged-currency>
<cart-item>
<sku>
<sku-id>2180434</sku-id>
</sku>
<quantity>1</quantity>
<item-sub-total>20.00</item-sub-total>
<item-coupon-total>10.00</item-coupon-total>
<item-total>10.00</item-total>
</cart-item>
<coupons>
<coupons-total>10.00</coupons-total>
</coupons>
<tax>0.00</tax>
<tax-rate>0</tax-rate>
<total-cart-cost>10.00</total-cart-cost>
</cart>
</cart-info>'
<!-- NOTE: Actual taxes may differ from this example -->
<!-- Response begins below -->
<cart-info xmlns="http://ws.plimus.com">
<cart>
<charged-currency>USD</charged-currency>
<cart-item>
<sku>
<sku-id>2176834</sku-id>
</sku>
<quantity>1</quantity>
<item-sub-total>49.99</item-sub-total>
<item-coupon-total>0.00</item-coupon-total>
<item-total>49.99</item-total>
</cart-item>
<coupons>
<coupons-total>0.00</coupons-total>
</coupons>
<tax>4.12</tax>
<tax-rate>8.25</tax-rate>
<total-cart-cost>54.11</total-cart-cost>
</cart>
</cart-info>