POST /CheckOut2Api/UpdateItems
The method allow partner to update items in checkout form. For example, when checkout is loaded andcustomer add more content to cart.
Name | Data Type | Default Value | Description |
---|---|---|---|
PurchaseId | String | None. Must be specified. | An ID acquired when initializing a Check-Out session. |
Price | Decimal | None. Must be specified | The total amount to pay. Must be greater than 0. |
OrderReference | String | None. Must be specified. | An ID that identifies the order for which the purchase is to be made. |
Items | List of Items | None. At least one item must be specified. | A list of items representing the individual rows on an invoice. Individual items may have a negative value but the total sum of all items must be positive. |
PostId | String | POS ID is the device number. It is visible on every printout from the POS terminal in the left top corner of the receipt below your contact details or on a sticker on the POS terminal. | |
Attachment | String | None. | A custom data to update the data attached previously. |
The class represents a single row that appears on an invoice. Typically a purchased commodity but it can also be a more abstract think such as a discount with a negative value.
{
"PurchaseId": "19ac0d1ee909c302d212b4324d9194b5",
"Price": 100.00,
"Items": [
{
"Description": "Blue ball",
"Notes": null,
"Amount": 1.00,
"TaxCode":12,
"TaxAmount":"TaxAmount"
}
]
}
If successful, the method returns a HTTP status code 200 (OK) with no additional content.
Example Ajax request
<script type="text/javascript">
function refreshCart() {
var url = "/DemoShopPRODA/Cart/GetCart";
var test;
$.ajax({
url: url,
type: "get",
cache: false,
dataType: "html",
success: function(result) {
test = result;
$("#cart-table").html(result);
}
});
}
$(".addFirstProductToCart").click(function (e) {
var url = "/DemoShopPRODA/Cart/UpdateCart?productId=" + 1 + "&quantity=1";
$.ajax({
url: url,
method: "GET",
cache: false,
success: function (data) {
AvardaCheckOutClient.updateItems();
refreshCart();
}
});
});
$(function () {
$(".cartItem").change(function(e) {
var id = $(e.currentTarget).attr("id").split('_')[1];
var quantity = $(e.currentTarget).val();
var url = "/DemoShopPRODA/Cart/UpdateCart?productId=" + id + "&quantity=" + quantity;
$.ajax({
url: url,
method: "POST",
data: {
productId: id,
quantity: quantity
},
cache: false,
success: function (data) {
AvardaCheckOutClient.updateItems();
refreshCart();
}
});
});
});
</script>