PaymentRequestUpdate

Interface that describes the object argument of the paymentRequest.addEventListener method return value.

Use this interface to create an object that contains payment request properties that are to be updated in the digital wallet payment sheet after recalculating fees or catching buyer input errors.

Properties

req.addEventListener('shippingcontactchange', (contact) => { if (contact.countryCode !== 'US') { return { error: 'Unfortunately, we only ship to US addresses.'}; } }
paymentRequestUpdate.js
JS
JavaScript

req.addEventListener('shippingcontactchanged', (contact) => {

  const shippingErrors = "shippingErrors": {

      "addressLines": "1234 Nth Main Street",

      "city": "New Bork",

      "country": "XSA",

      "postalCode": "9468x",

      "MY"

  };

  const shippingLineItems = "shippingLineItems":[

      {

       "label": "Shipping charges",

       "amount": "15.69",

       "pending": true

      }

   ];



  const taxLineItems = "taxLineItems":[

      {

       "label": "State Tax",

       "amount": "8.95",

       "pending": true

      }

   ];

   const total = "total": "412.00";

   return { shippingErrors, shippingLineItems, taxLineItems, total };

});