- From: Andrzej Rosiek <notifications@github.com>
- Date: Wed, 04 Oct 2017 08:34:50 -0700
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-request/issues/637@github.com>
why the following code: ``` function onBuyClicked() { if (!window.PaymentRequest) { // PaymentRequest API is not available. Forwarding to // legacy form based experience. location.href = '/checkout'; return; } // Supported payment methods var supportedInstruments = [{ supportedMethods: ['basic-card'], data: { supportedNetworks: [ 'visa', 'mastercard', 'amex', 'discover', 'diners', 'jcb', 'unionpay' ] } }]; // Checkout details var details = { displayItems: [{ label: 'Original donation amount', amount: { currency: 'USD', value: '65.00' } }, { label: 'Friends and family discount', amount: { currency: 'USD', value: '-10.00' } }], total: { label: 'Total due', amount: { currency: 'USD', value : '55.00' } } }; // Credit card incurs a $3.00 processing fee. const creditCardFee = { label: "Credit card processing fee", amount: { currency: "USD", value: "3.00" }, }; // Modifiers apply when the user chooses to pay with // a credit card. const modifiers = [ { additionalDisplayItems: [creditCardFee], supportedMethods: "basic-card", total: { label: "Total due", amount: { currency: "USD", value: "68.00" }, }, data: { supportedTypes: "credit", }, }, ]; Object.assign(details, { modifiers }); // 1. Create a `PaymentRequest` instance var request = new PaymentRequest(supportedInstruments, details); // 2. Show the native UI with `.show()` request.show(); } ``` brings error: ``` test.html:509 Uncaught TypeError: Failed to construct 'PaymentRequest': The provided value cannot be converted to a sequence. at onBuyClicked (test.html:509) at HTMLButtonElement.onclick (test.html:427) ``` according to https://www.w3.org/TR/payment-request/#x2.2.2-conditional-modifications-to-payment-request it should works. -- 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/issues/637
Received on Wednesday, 4 October 2017 15:35:29 UTC