Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 1.24 KB

PaymentRequestUpdateEvent.md

File metadata and controls

65 lines (54 loc) · 1.24 KB

PaymentRequestUpdateEvent

constructor(name, paymentRequest)

Initializes the payment request update event.

Arguments

  • name - onshippingaddresschange | onshippingoptionchange
  • paymentRequest - PaymentRequest
Example
const event = new PaymentRequestUpdateEvent('onshippingaddresschange', paymentRequest);

updateWith(details)

Updates the payment request with the details provided.

Arguments

  • details - PaymentDetailsUpdate
Example
event.updateWith({
  displayItems: [
    {
      label: 'Movie Ticket',
      amount: { currency: 'USD', value: '15.00' }
    },
    {
      label: 'Shipping',
      amount: { currency: 'USD', value: '5.00' }
    }
  ],
  total: {
    label: 'Merchant Name',
    amount: { currency: 'USD', value: '20.00' }
  },
  shippingOptions: [
    {
      id: 'economy',
      label: 'Economy Shipping',
      amount: { currency: 'USD', value: '0.00' },
      detail: 'Arrives in 3-5 days'
    },
    {
      id: 'express',
      label: 'Express Shipping',
      amount: { currency: 'USD', value: '5.00' },
      detail: 'Arrives tomorrow',
      selected
    }
  ]
});