- From: Domenic Denicola <notifications@github.com>
- Date: Tue, 15 Aug 2017 20:07:40 -0700
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 16 August 2017 03:08:02 UTC
domenic commented on this pull request. > + "fetch">Fetch API</a>: + </p> + <pre class="example"> + async function doPaymentRequest() { + const payRequest = new PaymentRequest(methodData, details, options); + const payResponse = await payRequest.show(); + let result = "unknown"; + try { + const httpResponse = await fetch("/process-payment", { + method: "POST", + headers: new Headers({ "Content-Type": "application/json" }), + body: payResponse.toJSON(), + }); + result = httpResponse.ok ? "success" : "fail"; + } catch (err) { + console.error(err); Maybe do a quick parse of response.json() ? I dunno. I have a hard time understanding "unknown" in real-world systems... -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/payment-request/pull/583#discussion_r133350416
Received on Wednesday, 16 August 2017 03:08:02 UTC