- From: Rouslan Solomakhin <notifications@github.com>
- Date: Thu, 24 Mar 2016 08:43:55 -0700
- To: w3c/browser-payment-api <browser-payment-api@noreply.github.com>
- Message-ID: <w3c/browser-payment-api/issues/4/200893925@github.com>
I've thought of a better way to accomplish payment method specific discounts: have two "Buy" buttons on the webpage. This lets us keep the API simple in v1 and still accommodate the use case. What do you think? Example:
````html
<button onClick="discountPrice();">Use Foo to buy for $0.70</button>
<button onClick="fullPrice();">Buy for $1.00</button>
<script>
function discountPrice() {
new PaymentRequest(
["foo"],
{"items": [{
"id": "original",
"label": "Original price",
"amount": {"currencyCode": "USD", "value": "1.00"}
}, {
"id": "foodiscount",
"label": "Foo payment method discount",
"amount": {"currencyCode": "USD", "value": "-0.30"}
}, {
"id": "total",
"label": "Total amount",
"amount": {"currencyCode": "USD", "value": "0.70"}
}]}).show().then(chargeDiscountPrice).catch(handleError);
}
function fullPrice() {
new PaymentRequest(
["visa", "mastercard", "amex"],
{"items": [{
"id": "total",
"label": "Total amount",
"amount": {"currencyCode": "USD", "value": "1.00"}
}]}).show().then(chargeFullPrice).catch(handleError);
}
</script>
````
---
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/4#issuecomment-200893925
Received on Thursday, 24 March 2016 15:44:23 UTC