Create a payment request object

The PaymentRequest object is constructed by defining the following:

  • Payment instrument.
  • Order details.
  • Options.

If payment request API isn't supported in the customer’s browser, the created object will be null.

Create a payment request

The following code snippet illustrates how to create a PaymentRequest object.

let request = null;
try {
  request = new PaymentRequest(supportedInstruments, details);
} catch (e) {
  console.log('Payment Request Error: ' + e.message);
  return;
}
if (!request) {
  console.log('Web payments are not supported in this browser.');
  return;
}