Re: [webpayments] How are cloud-based payment instruments supported? (#16)

> I think there will be no redirects. A browser will open a new tab, window, or dialog with the payment provider website. The browser is then responsible for piping information between the merchant website and the payment provider website.

That's exactly right @rsolomakhin.

The way we've implemented this in the Credentials CG reference implementation (which has a tremendous amount of overlap with how the Web Payments API could be implemented) is by using a Promise that is fulfilled once the payment request has been processed by the payment processor. A code example of what this looks like to the Web developer can be seen here:

http://wicg.github.io/web-payments-browser-api/#processing-a-payment-request

Here's how a polyfill for it could be implemented.

1. navigator.payment.request(payRequest) is called, generating a Promise that the merchant waits to be resolved.
2. A pop-up opens, user selects the payment instrument, pop-up opens channel to payment processor via postMessage() or similar mechanism. I'm handwaving at the details as the thing that's important is that the channel to the merchant is kept open and a channel to the payment processor is opened, and something exists to relay the message back and forth between those two actors (the pop-up).
3. payment processor processes payment request, calls navigator.payment.acknowledge(payResponse), which relays the payment acknowledgement back to the pop-up, which relays the payment acknowledgement back to the merchant, which fulfills the promise.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webpayments/issues/16#issuecomment-161502762

Received on Thursday, 3 December 2015 03:09:21 UTC