Top Banner
Payment Request API
101

W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Apr 15, 2017

Download

Technology

FIDO Alliance
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Payment Request API

Page 2: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Demo

Page 4: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Before looking at details of the API, let’s first look at the UI…

Page 5: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 6: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Click the Buy button…

Page 7: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 8: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Trusted UI dialog controlled by browser

Page 9: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Note the dialog shows the origin/domain that

generated the dialog

Page 10: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Note also thatbrowser selects a

default payment method

Page 11: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 12: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Click the Edit button…

Page 13: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 14: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Choose amongother available

payment methods

Page 15: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Payment instruments shownare the intersection of:

● those the merchant supports● those the user has

Page 16: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Other options todisplay to users…

Page 17: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Shipping address

Page 18: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 19: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Again, the browser chooses a default shipping address, butuser can select among other

shipping addresses

Page 20: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What do you think of that UI?

Page 21: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Criticisms?

Page 22: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Code samples

Page 23: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 24: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Two dictionaries…

Page 25: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● “supportedInstruments”● “details”

Page 26: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Actually…

Page 27: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● PaymentMethodData (includes supportedMethods field)

● PaymentDetails (includes total, displayItems, shippingOptions)

Page 28: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What do we do with the PaymentMethodData &

PaymentDetails?…

Page 29: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 30: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What is that code doing?

Page 31: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

The code calls new PaymentRequest w/ PaymentMethodData and PaymentDetails

to construct a payment request

Page 32: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

…it then calls .show() method of constructed payment request object

Page 33: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 34: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

PaymentRequest.show() triggers the trusted UI

and returns a Promise…

Page 35: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

“instrumentResponse”

Page 36: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Actually the Promise returned is a…

Page 37: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● PaymentResponse which includes a methodName field with the payment method the user chose, along with details

Page 38: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 39: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

PaymentResponse.complete() returns another Promise…

Page 40: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

After that Promise returns, your web-app code can consume

PaymentResponse.methodName & PaymentResponse.details etc.

Page 41: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

That’s it.

Page 42: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Other options in the API…

Page 43: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● shippingOptions field for PaymentDetails dictionary

● PaymentOptions 3rd arg to constructor (includes (requestShipping field)

Page 44: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 45: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What about Apple Pay

for the Web?

Page 46: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Actually “Apple Pay for the Web” is not “for the Web”…

Page 47: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

In fact in reality it’s just“Apple Pay for Safari”

Page 48: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

“Apple Pay for the Web” is a non-standard Apple-only proprietary

API…

Page 49: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What are the differences between the Apple Pay for the Web API and the standard Payment Request API?

Page 50: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● canMakePayments() and canMakePaymentsWithActiveCard()

● merchant validation

Page 51: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Merchant validation

Page 52: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 53: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 54: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Code formerchant validation…

Page 55: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 56: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

canMakePayments() and canMakePaymentsWithActiveCard()

Page 57: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 58: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 59: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Apple Paycode sample

Page 60: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 61: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Compare…

Page 62: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 63: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 64: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What do you think of the Payment Request

API design?

Page 65: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Criticisms?

Page 66: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Thanks!

Page 67: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Michael[tm] Smith

W3C Deputy Director Keio SFC

[email protected] @sideshowbarker

Page 68: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Q&A

Page 69: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Background

Page 70: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Spec

Page 72: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Interface definitions

Page 73: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Two objects:● PaymentRequest● PaymentResponse

Page 74: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

PaymentRequest object

Page 75: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 76: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Three (dictionary) args for the PaymentRequest constructor…

Page 77: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

● PaymentMethodData● PaymentDetails● PaymentOptions

Page 78: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 79: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 80: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 81: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

PaymentResponse object

Page 82: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 83: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Call flow

Page 84: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Somewhat out-of-datecall flow for an earlier

version of the API

Page 85: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 86: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

New proposed call flow

Page 87: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 88: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

In that new call flow, the“Mediator” is the Web Browser (UA)

Page 89: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

What problem arewe trying to solve

With this API?

Page 90: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

For payments on the Web:

● Make a better user experience● Provide better security

Page 91: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Better user experience…

Page 92: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Streamline thecheckout experience…

Page 93: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Compare to an example of bad user experience

Page 94: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith
Page 95: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

That screen shot is from the ticket-buying website for a major theater chain

Page 96: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

That site is just one exampleof the kind of user-hostile

horrible UX/UI that we want toPayment Request to replace

Page 97: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Implementations

Page 98: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Already implemented in Chrome for Android (dev)

Page 99: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Shipping targeted maybefor Chrome 53 on Android

(stable) in “late 2016”

Page 100: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Will ship indesktop Chrome in 2017

Page 101: W3C Presentation -FIDO Alliance -Tokyo Seminar -Smith

Work in progress onbeing implementedin Microsoft Edge