[w3c/payment-request] Adding support for private-label credit cards (#662)

WebKit's Payment Request implementation recently [switched](https://trac.webkit.org/changeset/225849/webkit) from the non-standard "applepaypaymentmethodchanged" event to using PaymentDetailsModifiers for handling payment instrument changes in Apple Pay. This allows merchants to add additional display items based on the type of card selected by the user.

Right now, Apple Pay supports the following card types: "credit", "debit", "prepaid", and "store". For the first three types, the only information WebKit provided in "applepaypaymentmethodchanged" was the card type itself, so it's an easy migration to PaymentDetailsModifier for these types, e.g.:

```
{
    total: {
        label: 'Total',
        amount: {
            currency: 'USD',
            value: '10.00',
        },
    },
    displayItems: [{
        label: 'Item',
        amount: {
            currency: 'USD',
            value: '10.00',
        },
    }],
    modifiers: [{
        supportedMethods: 'https://apple.com/apple-pay',
        total: {
            label: 'Total',
            amount: {
                currency: 'USD',
                value: '15.00',
            },
        },
        additionalDisplayItems: [{
            label: 'Credit surcharge',
            amount: {
                currency: 'USD',
                value: '5.00',
            },
        }],
        data: {
            paymentMethodType: 'credit',
        },
    }
}
```

However, for "store" cards (private-label credit cards), Apple Pay provided the merchant associated with the card with additional account information in "applepaypaymentmethodchanged" so that they can apply discounts based on factors like "points", premium account status, etc. In the PaymentDetailsModifier model, there is no clear way to do this, since the additional display items will differ from customer to customer.

While PaymentDetailsModifier will work fine for most use cases involving credit, debit, and prepaid cards, it would be nice to also have a solution in Payment Request for private-label cards.

Obviously one solution would be to add a standard "paymentinstrumentchange" event where payment methods can include arbitrary additional information, and use that in addition to (or instead of?) PaymentDetailsModifiers. I'd be interested to hear if there are other ideas, though.

cc: @marcoscaceres @rsolomakhin 

-- 
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/662

Received on Thursday, 14 December 2017 22:36:40 UTC