Created with Sketch.
Created with Sketch.
Checkout 2.0


POST /CheckOut2Api/UpdateDeliveryAddress

An option for explicitly change/update the delivery address. Customer loads checkout first and if customer select deliver to pre defined delivery address, delivery address will be replaced and option to change delivery address in the checkout should be forbidden.

How it works: 

  1. Merchant can update DeliveryAddress if checkout is in BeingProcessedState 
  2. Customer loads a checkout 
  3. If merchant provides a selection of delivery address options outside the checkout that customer wants – Merchant can patch DeliveryAddress. 
  4. Merchant will send UpdateDeliveryAddress request with selected address.
  5. Merchant will send Message to checkout “reloadDeliveryAddress”. This will reload checkout.
  6. Customer should not be able to change DeliveryAddres until he change Delivery option again. If customer change delivery option merchant has to send UpdateDeliveryAddress request again and reloadDeliveryAddress with same data but with UseDifferentDeliveryAddress = false; 

Input parameters

NameData TypeDefault valueDescription
PurchaseIdEmpty StringNone. Must be specifiedAn ID acquired when initializing a Check-Out session
DeliveryAddressNone. Must be specifiedDelivery address object
FirstNameStringDelivery First Name
LastNameStringDelivery Last Name
AddressStringDelivery Address
ZipCodeStringDelivery Zip code
CityStringDelivery City
UseDifferentDeliveryAddressBooleanTrueTrue = Change delivery address option not editable in checkout
Fales = Change delivery address option editable in checkout

Example request

     "PurchaseId": "e422f4b5fb5d4edec496b15556203ea0", 
     "DeliveryAddress": { 
         "FirstName": "Kalle", 
         "LastName": "Andersson", 
         "Address": "Storgatan 27", 
         "ZipCode": "50110", 
         "City": "Borås", 
         "UseDifferentDeliveryAddress": true 

Example for update ajax request

    <script type="text/javascript">
            function updateDeliveryAddress(e) {
                var id = "@Html.Raw(Model.PurchaseID)";
                var url = "/avarda/updateDeliveryAddress?PurchaseId=" + id;
                        url: url,
                        method: "POST",
                        data: {
                            PurchaseId: id
            cache: false,
            success: function () {
                var messagePrefix = "AvardaCheckOut:";
                var message = messagePrefix + JSON.stringify({ type: 'reloadDeliveryAddress'});
                window.parent.postMessage(message, "*");