Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]
Controls the payment request made by a user. A PaymentRequest object is created by calling the PaymentRequest constructor.
Syntax
var newPayment = new PaymentRequest(methodData, details, options);
Members
The PaymentRequest object has these types of members:
- Events
- Methods
- Properties
Events
The PaymentRequest object has these events.
Event | Description |
---|---|
onshippingaddresschange | Fires when there is a change to the shipping address. |
onshippingoptionchange | Fires when there is a change to a shipping option. |
Methods
The PaymentRequest object has these methods.
Method | Description |
---|---|
abort | Aborts a PaymentRequest. |
show | Called by the web page to allow the user to interact with the Payment Request UI. |
Properties
The PaymentRequest object has these properties.
Property | Description |
---|---|
The shipping address selected by the user. |
|
The ID for the selected shipping option. |
Remarks
The PaymentRequest constructor includes the following parameters:
Parameter | Type |
---|---|
methodData | sequence<PaymentMethodData> |
details | PaymentDetails |
options | PaymentOptions |
PaymentMethodData dictionary:
Field | Type | Description |
---|---|---|
supportedMethods | sequence<DOMString> | Required sequence of strings containing payment method identifiers for payment methods that the merchant web site accepts. |
data | object | a JSON object that provides optional information that might be needed by the supported payment methods. |
PaymentDetails dictionary:
Field | Type | Description |
---|---|---|
total | PaymentItem | Contains the total amount of the payment request. |
displayItems | sequence<PaymentItem> | A sequence of PaymentItem dictionaries that contain line items for the payment request. |
shippingOptions | sequence<PaymentDetailsModifier> | A sequence containing the different shipping options that the user can choose. If empty, this indicates the merchant cannot ship to the current shippingAddress. |
modifiers | sequence<PaymentDetailsModifier> | A sequence of PaymentDetailsModifier dictionaries that contains modifiers for particular payment method identifiers. |
PaymentDetailsModifier dictionary:
Field | Type | Description |
---|---|---|
supportedMethods | sequence<DOMString> | Required. Contains a sequence of payment method identifiers. |
total | PaymentItem | This value overrides the total field in the PaymentDetails dictionary for the payment method identifiers in the supportedMethods filed. |
additionalDisplayItems | sequence<PaymentItem> | A sequence of PaymentItem dictionaries that provides additional display items that are appended to the displayItems field in the PaymentDetails dictionary for the payment method identifiers in the supportedMethods filed. For example, a discount. |
PaymentOptions dictionary:
Field | Type | Description |
---|---|---|
requestPayerEmail | boolean | Indicates whether the browser should collect and return the payer's email address as part of the payment request. |
requestPayerPhone | boolean | Indicates whether the browser should collect and return the payer's phone number as part of the payment request. |
requestShipping | boolean | Indicates whether the browser should collect and return the shipping address as part of the payment request. |
requestPayerName | boolean | Indicates whether the browser should collect and return the payer's name as part of the payment request. |
shippingType | DOMString | Used to change the way the browser presents the UI for gathering the shipping address:
ValueDescription
shippingDefault. Refers to the address being collected as the destination for shipping.
deliveryRefers to the address being collected and used for delivery. Usually faster than shipping, like pizza delivery.
pickupRefers to the address being collected and used as part of a service pickup, like laundry pickup.
|
PaymentItem dictionary:
Field | Type | Description |
---|---|---|
label | DOMString | A human-readable description of the item. |
amount | PaymentCurrencyAmount | A PaymentCurrencyAmount containing the monetary amount for the item. |
pending | boolean | When set to true, this means the amount is not final. Used to show items like shipping and tax that depend on the shipping location or shipping option. |
PaymentCurrencyAmount dictionary:
Field | Type | Description |
---|---|---|
currency | DOMString | A string containing a currency identifier, like "USD". |
value | DOMString | A string containing the decimal monetary value, like "25.00". |
currencySystem | DOMString | A URL that indicates the currency system that currency belongs to. Default value is urn:iso:std:iso:4217 indicating that currency is defined byISO 4217. |
PaymentShippingOptoin dictionary:
Field | Type | Description |
---|---|---|
id | DOMString | A string identifier used to reference this PaymentShippingOption. This must be unique for a given PaymentRequest. |
label | DOMString | A human-readable description of the item. This is what the browser displays as the shipping option to the user. |
amount | PaymentCurrencyAmount | A PaymentCurrencyAmount containing the monetary amount for the item. |
selected | boolean | Set to true, this indicates that this is the default selected PaymentShippingOption. |