- From: Adrian Hope-Bailie <notifications@github.com>
- Date: Thu, 07 Apr 2016 14:08:23 -0700
- To: w3c/browser-payment-api <browser-payment-api@noreply.github.com>
Received on Thursday, 7 April 2016 21:08:56 UTC
Part of the problem with using the constructor is that we have no namespaced place to hang other API methods that we are still working on for things like registration, getting the PaymentRequest and submitting the PaymentResponse as a web based payment app. A factory pattern might be a good compromise? ## Proposal Put the `PaymentRequest` constructor behind a factory method. Sample javascript: ```javascript var payment = navigator.payments.newPaymentRequest(supportedMethods, details, options, data); payment.addEventListener("shippingaddresschange", function (changeEvent) { // Process shipping address change }); payment.show().then(function(paymentResponse) { // Process paymentResponse // paymentResponse.methodName contains the selected payment method // paymentResponse.details contains a payment method specific response paymentResponse.complete(true); }).catch(function(err) { console.error("Uh oh, something bad happened", err.message); }); ``` --- 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/browser-payment-api/issues/16#issuecomment-207088713
Received on Thursday, 7 April 2016 21:08:56 UTC