ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

FR: Support Apple Pay #8038

Closed sumodas closed 5 years ago

sumodas commented 7 years ago

Goal: Load Apple Pay payment sheet on AMP pages (i.e. AMP Product Page, amp.www.1800flowers.com/floral-embrace-100229). Might this be possible in an amp iframe or amp component?

Requirements/Required Fields: The ApplePay payment sheet requires the following values to pass through to complete a transaction:

  1. Card & Billing Address field
  2. Shipping Address (essential to validate product availability & shipping cost for postal code)
  3. Method (a.k.a. Pick Delivery Date - this will show dates specific to the postal code from Shipping Address field)
  4. Contact Information (email & phone number)
  5. Pay with Touch ID

Live Example of an ApplePay implementation on non-AMP product page can be found: m.www.1800flowers.com/floral-embrace-100229

Why Not on AMP? Apple Pay payment sheet calls javascript to be fired on page

CC: @sebastianbenz @rudygalfi , @jenniferlynparsons, @ddelerme, @sajadreshi

dknecht commented 7 years ago

I wonder if there is need for amp-payments extension and built in a way the Stripe, Braintree, Apple Pay, Android Pay, etc could all build adapters. There is also the payment notification API work being done in chrome.

aghassemi commented 7 years ago

/cc @ericlindley-g

aghassemi commented 7 years ago

@sumodas We don't have a full-fledged amp-payments solution yet, but we do support Chrome's PaymentRequestAPI in an iframe. see https://github.com/ampproject/amphtml/issues/7623

aghassemi commented 7 years ago

related: #7691

sumodas commented 7 years ago

@ericlindley-g @aghassemi @cramforce

Is there any update on whether a payment component (i.e. Payment Request or ApplePay) is available on AMP or is amp-iframe still the path forward?

On a similar note, is there support for 3rd party wallets such as PayPal, Visa Checkout, Master Pass, American Express?

Thanks!

CC: @jenniferlynparsons, @ddelerme, @sajadreshi

ericlindley-g commented 7 years ago

Hi @sumodas — the Payment Request API works on platforms where it has been implemented (Android Chrome — and possibly Edge @aghassemi , do you know if AMP in Edge supports this?). One great path would be if the API is adopted across the board, and it becomes trivial to add additional support in AMP.

However, there isn't native payment support outside of that yet—the team is doing research now into other possibilities, but doesn't have a firm date for support targeted.

Same with 3rd party wallets — I'm not yet sure what the implementation path would be for those, but @aghassemi , @choumx or @cramforce , would an integration for PayPal, etc be as straightforward as, say, a 3P video integration, or ad integration? (It's unclear to me the degree of direct input we'd need from these services in order to integrate)

Regardless would be great to get all of this working seamlessly in AMP :)

cramforce commented 7 years ago

I believe that Apple's non-standard implementation of the PaymentRequest API does not work in iframes. Not 100% sure tho.

aghassemi commented 7 years ago

Edge will have support for Web Payments API (probably including iframe support) soon (as part of EdgeHTML 15 which is in dev preview now)

On the same boat as Malte regarding Apple Pay, haven't tested but internet seems to suggest it won't work in iframes.

For other payments solutions, we need to test and evaluate case-by-case. Some may just work with amp-iframe, some may need to become an extensions or may only work when we have https://github.com/ampproject/amphtml/issues/9074

sumodas commented 7 years ago

Thanks Ali, Malte and Eric, this is super helpful. We'll continue digging deeper and report back any findings.

On Fri, Jun 23, 2017 at 2:15 PM, Ali Ghassemi notifications@github.com wrote:

Edge will have support for Web Payments API (probably includingiframe support https://www.chromestatus.com/feature/5511036157296640 soon https://blogs.windows.com/msedgedev/2016/12/15/payment-request-api-edge/#vak0g3EmKZ8wIpTD.97 (as part of EdgeHTML 15 which is in dev preview now) ( https://www.chromestatus.com/feature/5511036157296640))

On the same boat as Malte regarding Apple Pay, haven't tested but internet seems to suggest it won't work in iframes.

For other payments solutions, we need to test and evaluate case-by-case. Some may just work with amp-iframe, some may need to become an extensions or may only work when we have #9074 https://github.com/ampproject/amphtml/issues/9074

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/8038#issuecomment-310736825, or mute the thread https://github.com/notifications/unsubscribe-auth/AZFmuScPTel3KZs0j-t-LxHGvU-J-ezjks5sHADOgaJpZM4MYWhI .

-- Sumantro Das M: +1 (845) 558 8313 E: sumantro.das@gmail.com

88kbbq commented 7 years ago

Trying to fit Stripe into an AMP HTML page, and I really don't see why this won't work. Why not just whitelist their stripe.js and be done with it. Such an easy solution for AMP Commerce

ericlindley-g commented 7 years ago

Hey @88kbbq — yours is a good question, and it comes down to what makes AMP work. As soon as third-party javascript is in the document, none of the basic guarantees of AMP (speed, constraints on bad UX, etc) can be made, so the document shouldn't be validated and cached by AMP caches.

Functionality and javascript for 3Ps can, however, be added directly through components that are reviewed to make sure they're in line with the basic guarantees of AMP. I'm not familiar enough with Stripe to know what integration path would be the best, or what the current barriers are (it may already be possible to use Stripe through amp-iframe), but it would be great to get a really easy, as-native-as-possible solution for it (and other payment services) in AMP.

88kbbq commented 7 years ago

I respectfully disagree that 3P js would make sites slow or bad in any way. The better way to improve site speed is allow 50kb of JS, just like 50kb of css. Then you don't need to wait for 3P to make an AMP HTML element. This is so silicon valley. And it's kinda evil.

I'm gonna bow out. AMP is just not gonna let me do what I wanna do. I'll check back next year.

ericlindley-g commented 7 years ago

I should clarify: it's true that 3P js doesn't always make sites slow or bad — the challenge is that there's no feasible way to verify that arbitrary 3P js doesn't interfere with the things that AMP JS does to ensure speed and good UX—unless it's manually reviewed. That's why this review and integration pathway is available in AMP.

Either way, it's okay if AMP isn't for you, now. We want to make AMP useful for as many people as possible, but it won't fit every use case.

rudygalfi commented 7 years ago

cc @lswang1618

ampprojectbot commented 6 years ago

This issue hasn't been updated in awhile. @ericlindley-g Do you have any updates?

ampprojectbot commented 6 years ago

This issue hasn't been updated in awhile. @lswang1618 Do you have any updates?

rudygalfi commented 6 years ago

There aren't any updates on this.

ampprojectbot commented 6 years ago

This issue hasn't been updated in awhile. @rudygalfi Do you have any updates?

aghassemi commented 5 years ago

deduping with https://github.com/ampproject/amphtml/issues/7691