Integration of Apple Pay JS on the site

I am learning Apple Pay integration on a website using the new Apple Pay JS SDK. The documentation is pretty minimal ApplePaySession only API declarations and how to create a new ApplePaySession object.

Is there any other sample code, or did anyone actually implement it themselves, showing a typical API integration thread for a web application?

The only examples I could find for everyone seemed to be the proprietary SDK applications of third-party Apple Pay payment providers.

+8
html applepay applepayjs
source share
3 answers

I posted the full ApplePayJS code sample on github here

https://github.com/norfolkmustard/ApplePayJS

It uses PHP for the part of the server needed to initially test the vendor in order to start the transaction. The rest is in javascript.

ApplePayJS! = Cash in the bank, it's just a means of receiving a symbolic credit card from a client. You transfer this card number to a third-party payment process, for example stripe.com, braintreepayments.com, authorize.net

Greetings

+8
source share

A stable version will be available this fall.

The first thing you want to do is make sure the API is available in your browser:

 if(ApplePaySession) ApplePaySession.canMakePayments() 

Then the transaction itself:

 var request = { countryCode: 'US', currencyCode: 'USD', supportedNetworks: ['visa', 'masterCard'], merchantCapabilities: ['supports3DS'], total: { label: 'Your Label', amount: '10.00' }, } var session = new ApplePaySession(1, request); 

From the official website, how to get started: https://developer.apple.com/reference/applepayjs/applepaysession

After the session, you can manage it: enter image description here

And you can listen to events and change your stream based on this: enter image description here

I'm currently working on integration between Apple Pay JS and the Stripe API, so I will release a draft on GitHub this summer.

+5
source share

The integration that I worked on was finally released, and there I wrote a blog post along with it, as well as the GitHub project with an example of integration using ASP.NET Core.

I hope others who make Apple Pay JS integration find this useful.

+2
source share

All Articles