Re: [w3c/payment-request] Support for gift cards and discount codes (#145)

:wave: I can provide some guidance from the Shopify side here. Take all of this with a grain of salt as what is best for our platform might not apply for the broader public of Payment Request.

To start it off, Shopify uses the field for both discount codes **and** gift cards alike. Now the interesting part here is that we only ever allow the customer to apply one of each. I'll follow below with some user stories and scenarios that we found to work best for the user experience.

As a side note (and this might become more of a browser vendor implementation detail), we change the copy on the `offer code` field per merchant use case. For example:

* We don't show the field if the merchant has no discount codes nor gift cards
* We show the field with the copy "Discount code" if the merchant only supports discount codes
* We show the field with the copy "Gift Card" if the merchant only supports gift cards
* We show the field with the copy "Discount code or Gift Card" if the merchant supports both

We found this to be the least confusing of experiences for the user. This _might_ lead us to wonder if the copy should be customizable by the integrator. :shrug:

Finally, we allow discount codes to be applied through URL permalinks, to support email promotions for example.

As such, here are the features that could be interesting to have (user stories and scenarios to follow):

* Allow for a `offer code` field to be surfaced
* Allow for a `offer code` to applied by the integrator
* Allow for multiple offer codes to be applied
* Allow for a `offer code` to be removed
* Allow for errors to be surfaced on the offer code field

Notice that the feature of editing a `offer code` is not mentioned; for Shopify at least, we find that as long as a `offer code` can be overriden (the last offer code applied - be it a discount or gift card - takes precendence as long as it's valid) and these can be removed, there would be no need to have the ability to edit one. Thus, we also never deactivate or change the state of the `offer code` field; rather, `offer code` line iterms surface as removable receipt line items on our checkout. 

All of that being said, I love your latest proposition @marcoscaceres! I'd love to discuss a bit more the following things:

1. Is the `requestOfferCodes` attribute necessary? If we would consider Payment Request having a single `offer code` input field that is either there or not, with no possibility to edit offer codes (only to override them), is that attribute still necessary? I quite liked the idea of keeping it just as a boolean (as per the first draft)
2. How does `offerCodes` being populated affect the UI? i.e. Does the integrator still have to add a display item themselves for an offer code line item?

This is to say, should the offer code input concept be seperated from the offer code line item? Could it be possible to make offerCodes part of the displayItems rather than a seperate entity?

Thanks y'all on your comprehension for this very long post. Hopefully this provides more insight than noise on further offer code discussions.

## User stories

```
As a merchant
I want to offer discount codes on my store
In order to drive sales to my shop

As a merchant
I want to offer gift cards on my store
In order to drive recurring sales to my shop

Scenario: A customer applies multiple reductions to their checkout
  Given a merchant supports both discount codes and gift cards
  And the merchant has a "PROMO10" discount code, which reduces the order by 10%
  And the merchant has a "PROMO20" discount code, which reduces the order by 20%
  And the merchant has a "THANKS" gift card code, which reduces the order by 10$
  When I start the checkout process
  And I have a single "Digital Game" item of value 20$
  Then I see a field with copy "Discount code or Gift Cards"
  
  When I enter the discount code "PROMO10"
  Then I see my receipt line items as such:
    | line item    | value |
    | Digital Game | 20$   |
    | PROMO10      | -10%  |
    | Total        | 18$   |
  
  When I enter a discount code "PROMO20"
  Then I see my receipt line items as such:
    | line item    | value |
    | Digital Game | 20$   |
    | PROMO10      | -20%  |
    | Total        | 16$   |
    
  When I enter a gift card code "THANKS"
  Then I see my receipt line items as such:
    | line item    | value |
    | Digital Game | 20$   |
    | PROMO20      | -20%  |
    | THANKS       | 10$   |
    | Total        | 6$    |
    
  When I remove the discount code
  Then I see my receipt line items as such:
    | line item    | value |
    | Digital Game | 20$   |
    | THANKS       | 10$   |
    | Total        | 10$   |
```

-- 
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/145#issuecomment-387314219

Received on Tuesday, 8 May 2018 07:42:20 UTC