Checkout 2.0
Pay on delivery

Checkout supports Pay on delivery for partners who requires it. New additional payment option (Pay on delivery) is then shown in the checkout and if used the payment session and order is accepted immediately. Partner needs to consider the GetPaymentStatus.PaymentMethodID to determine which payment method was used and if payment needs to be requested before goods are delivered.

Please Note!

PurchaseOrder, ReturnOrder and Refund is not applicable for this Pay on delivery payment option.

In the JavaScript options used to init the Checkout form the hook handleExternalPaymentUrl needs to be defined.

Code Example:

var url =
  'http://avardatest.cngroup.dk/DemoShopU/Cart?purchaseId=39e0b9a107bd70d5649ca4ca152737ab';
var paypalUrl = '/DemoShopU/ExternalPayment/PayPal?paymentMethod=PayPal';
var payOnDeliveryUrl =
  '/DemoShopU/ExternalPayment/PayOnDelivery?paymentMethod=PayOnDelivery';
var backend2backendNotification =
  'http://avardatest.cngroup.dk/DemoShopU/MerchantNotification/PurchaseCompleted';
var options = {
  divId: 'checkOutDiv',
  purchaseId: '39e0b9a107bd70d5649ca4ca152737ab',
  callbackUrl: url,
  purchaseCompletedCallbackUrl: backend2backendNotification,
  done: function (purchaseId) {
    var urlPattern = '/DemoShopU/CheckOut/Done?purchaseId=PURCHASE_ID';
    var url = urlPattern.replace('PURCHASE_ID', purchaseId);
 
    window.location.href = url;
  },
  handleExternalPaymentUrl: function (purchaseId, paymentMethod) {
    if (paymentMethod == 7) window.location.href = paypalUrl;
    else if (paymentMethod == 8) window.location.href = payOnDeliveryUrl;
  },
  customCssUrl: '',
  redirectUrl: 'http://avardatest.cngroup.dk/DemoShopU/',
};
AvardaCheckOutClient.init(options);