If user updates their cart and already have an ongoing checkout. Use the update checkout to update the current checkout instead of creating a new one. You can re-use the getIframe method but the content will to some extent be different.

//SERVER SIDE Code to update checkout
$updateCheckoutAPIAddress = "http://sandbox.hygglig.com/Checkout/api/Checkout/UpdateOrder";
$updateCheckoutCheckSum = (SHA1($totalAmount . $secret));
$exampleArray = array(
   'MerchantKey' => $key,
   'Token' => $hyggligTokenFromCurrentCheckout,
   'Articles' => array(
      'Articles' => array(
         'ArticleName' => 'Hygglig Artikel',
         'Description'=>'En fantastisk artikel från Hygglig',
         'ArticleName' => 'Frakt',
         'Description'=>'Fraktsätt: Hyggligt',
//CLIENT SIDE Javascript Update Checkout Example
function updateCheckout() {
      url: '/DoUpdate',
      //Token = "c" value of iFrame src
      data: { 'Token': '20E03C0581F0C7FB52578EF88B4F620612B6DF57' },
      type: 'POST',
      success: function (data) {
         //Calls update function in iFrame
      error: function () {
         alert('Error occured');}

Use our demo shop to get an idea of how it can look

Go ahead – add a product and go to checkout.
Test the update function by changing shipping option.