Checkout 2.0
UpdateItems
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.

Input Parameters

NameData TypeDefault ValueDescription
PurchaseIdStringNone. Must be specified.An ID acquired when initializing a Check-Out session.
PriceDecimalNone. Must be specifiedThe total amount to pay. Must be greater than 0.
OrderReferenceStringNone. Must be specified.An ID that identifies the order for which the purchase is to be made.
ItemsList of ItemsNone. 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.
PostIdStringPOS 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.
AttachmentStringNone.A custom data to update the data attached previously.

Items

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.

Example request

{
  "PurchaseId": "19ac0d1ee909c302d212b4324d9194b5",
  "Price": 100.0,
  "Items": [
    {
      "Description": "Blue ball",
      "Notes": null,
      "Amount": 1.0,
      "TaxCode": 12,
      "TaxAmount": "TaxAmount"
    }
  ]
}

Return Value

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>