Re: [w3c/webpayments-payment-apps-api] Revisiting payment app filtering (#96)

@jakearchibald
> I think I get it, but could you provide a quick example (with code)?

Ok, I'll give it a shot. But instead of using the boring basic card payment method, I'm going to use a hypothetical visa checkout payment app. I've taken some of the property names and values from the [visa checkout specification](https://developer.visa.com/products/visa_checkout/guides), so this is not entirely unrealistic:

```javascript
var methodData = [
    {
        supportedMethods: [ "https://secure.checkout.visa.com/pay" ],
        data: {
            apikey: "9898df897df87df987df98d7f987df",
            xPayToken: "xv2:" + timestamp + ":" + hashString,
            settings: {
                payment: {
                    cardBrands: [ "VISA", "AMEX" ],
                    acceptCanadianVisaDebit: false
                }
            }
        }
    }
]
var details = {
    total: {
        label: "Total",
        amount: { currency: "USD", value: "100.00" }
    },
    displayItems: [
        {
            label: "Blue suede shoes",
            amount: { currency: "USD", value: "100.00" }
        }
    ],
    shippingOptions: [
        {
            id: "free",
            label: "Free shipping!",
            amount: { currency: "USD", value: "0.00" }
        }
    ],
    modifiers: []
}

var request = new PaymentRequest(methodData, details);
request.show()
```

Everything inside `methodData.data` is proprietary visa checkout stuff, which the browser knows nothing about. A hypothetical `canHandle()` method provided by the visa payment app, which the user has installed in his browser, could look at the supported cardBrands and the other information in `methodData.data` and compare this with the cardBrands that the user has previously registered with visa checkout and see if there is a match. If not, then maybe the app should return false.

-- 
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/webpayments-payment-apps-api/issues/96#issuecomment-275122937

Received on Wednesday, 25 January 2017 14:34:59 UTC