Integrating Apple Pay JS Into A Website

Martin Costello picture Martin Costello · Jun 14, 2016 · Viewed 19.2k times · Source

I'm looking into integrating Apple Pay into a website using the new Apple Pay JS SDK. The documentation is currently pretty minimal, concerning just the API declarations and how to instantiate a new ApplePaySession object.

Is there any example code available yet, or has anyone actually implemented this themselves yet, showing the typical API integration flow for a web application?

The only examples I've been able to find anything for all appear to be for third-party payment providers' own SDK integrations of Apple Pay.

Answer

Stu Cartwright picture Stu Cartwright · Aug 15, 2016

I've published end-to-end ApplePayJS example code on github here

https://github.com/norfolkmustard/ApplePayJS

It uses PHP for the server-side part, needed for the initial vendor validation to begin the transaction. The rest is in javascript.

ApplePayJS != cash in the bank, just a means of getting a tokenised credit card from a customer. You hand that card number off to a third-party payment processor like stripe.com, braintreepayments.com, authorize.net

Cheers