Skip to content

Commit b7fe7bd

Browse files
committed
PaymentRequestEvent.methodData
1 parent 465a428 commit b7fe7bd

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

microsoft-edge/progressive-web-apps-chromium/how-to/digital-goods-api.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ Use the `show` method of the `PaymentRequest` interface to purchase an item, aft
167167

168168
Once your products and details are displayed to the user, you can implement the purchase flow by using the Payment Request API. When combined with the Digital Goods API, the only required input parameter is `methodData`.
169169

170-
Use the `supportedMethods` member of the `methodData`⁠⁠ parameter in the `PaymentRequest` interface to identify Microsoft Store Billing as the payment method with the string `"https://store.microsoft.com/billing"`. Then in the `data` member, pass along the item ID as the `sku`.
170+
In the `PaymentRequest` constructor's `methodData`⁠⁠ parameter (type =`PaymentRequestEvent`):
171+
* Use the `supportedMethods` member to identify Microsoft Store Billing as the payment method with the string `"https://store.microsoft.com/billing"`.
172+
* In the `data` member, pass along the item ID as the `sku`:
173+
174+
<!-- todo: in PaymentRequest ctor, the 2nd param (details) is missing, per ctor docs: https://developer.mozilla.org/docs/Web/API/PaymentRequest/PaymentRequest - the 3rd param, "options", says "optional" next to it, unlike "details" param - is that page missing a 1-param overload? new PaymentRequest(methodData)
175+
-->
171176

172177
```javascript
173178
const details = await digitalGoodsService.getDetails(['monthly_subscription']);
@@ -196,8 +201,8 @@ This will display the Store purchase UI to the user, where the user can view det
196201
In the `details` property of the payment response, a purchase token is returned.
197202

198203
See also:
199-
* [PaymentRequest](https://developer.mozilla.org/docs/Web/API/PaymentRequest) at MDN.
200-
* [PaymentRequest: show() method](https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequest/show)
204+
* [PaymentRequest: show() method](https://developer.mozilla.org/docs/Web/API/PaymentRequest/show)
205+
* [PaymentRequestEvent: methodData property](https://developer.mozilla.org/docs/Web/API/PaymentRequestEvent/methodData)
201206

202207

203208
<!-- ====================================================================== -->
@@ -286,7 +291,8 @@ GitHub:
286291

287292
MDN:
288293
* [Payment Request API](https://developer.mozilla.org/docs/Web/API/Payment_Request_API)
289-
* [PaymentRequest](https://developer.mozilla.org/docs/Web/API/PaymentRequest)
294+
* [PaymentRequest: show() method](https://developer.mozilla.org/docs/Web/API/PaymentRequest/show)
295+
* [PaymentRequestEvent: methodData property](https://developer.mozilla.org/docs/Web/API/PaymentRequestEvent/methodData)
290296
* [Intl.NumberFormat](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat)
291297

292298
W3C:

0 commit comments

Comments
 (0)