{"_id":"5b8ec6a1f8dd7c0003385fb3","category":{"_id":"5b8ec6a1f8dd7c0003385fa3","version":"5b8ec6a1f8dd7c0003386069","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-11-03T20:45:01.593Z","from_sync":false,"order":1,"slug":"topics","title":"Orders"},"parentDoc":null,"project":"57336fd5a6a9c40e00e13a0b","user":"560d5913af97231900938124","version":{"_id":"5b8ec6a1f8dd7c0003386069","project":"57336fd5a6a9c40e00e13a0b","__v":0,"forked_from":"5b19742cb3baf90003cab5ae","createdAt":"2018-04-24T15:33:45.744Z","releaseDate":"2018-04-24T15:33:45.744Z","categories":["5b8ec6a1f8dd7c0003385fa2","5b8ec6a1f8dd7c0003385fa3","5b8ec6a1f8dd7c0003385fa4","5b8ec6a1f8dd7c0003385fa5","5b8ec6a1f8dd7c0003385fa6","5b8ec6a1f8dd7c0003385fa7","5b8ec6a1f8dd7c0003385fa8","5b8ec6a1f8dd7c0003385fa9","5b8ec6a1f8dd7c0003385faa","5b8ec6a1f8dd7c0003385fab","5b8ec6a1f8dd7c0003385fac"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.27 Release","version_clean":"8976.0.0-Extended","version":"8976-Extended"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-09T19:12:35.090Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[]},"settings":"","auth":"optional","params":[],"url":"/tools/cart-calculation"},"isReference":true,"order":3,"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` &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>, contains the following properties (see [cart-info](doc:cart-info)):\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`cart-params` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span> (see [cart-params](doc:cart-params))\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`cart` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span> (see [cart](doc:cart))\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`sku` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span> (see [sku](doc:sku))\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`coupons` *integer* &nbsp;&nbsp;&nbsp;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]","excerpt":"","slug":"cart-calculation","type":"endpoint","title":"Cart Calculation"}

postCart Calculation


Definition

{{ api_url }}{{ page_api_url }}

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>

Response 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>
<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 -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>

User Information

Try It Out


post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}