Creating order details

After defining the fields required for the PaymentRequest object, provide the order amount for a specific transaction.

To provide the order amount, define the am and cu fields in the payment request. Because the am and cu fields are calculated based on the defined order values, they’ll vary for every order.

The contents of the total parameter should contain a label parameter and an amount parameter consisting of a currency and value.

Defining order value

The following code snippet illustrates how to add an order amount based on the order. In this example, the static number ‘10.01’ is provided as a value for the amount variable.

const details = {
  total: {
    label: 'Total',
    amount: {
      currency: 'INR',
      value: '10.01', // sample amount
    },
  },
  displayItems: [{
    label: 'Original Amount',
    amount: {
      currency: 'INR',
      value: '10.01',
    },
  }],
};