Demo for Payment Request API and Apple Pay for the Web https://lab.tridnguyen.com/web-payments-example/.
To see Payment Request API, use Chrome on Android version 53 or later.
To see Apple Payfor the Web in action, use Safari on iOS 10 or macOS Sierra (please note that you'd need to have Apple Pay enabled on your phone, and "Allow Payments on Mac" enabled for desktop use).
If you'd like to have your own instance of this running, follow the steps below:
-
Create an Apple Developer Account (at https://developer.apple.com)
-
Create a Merchant ID (see Configuring Your Environment)
To generate the Payment Processing Certificate on your own, run the following steps
openssl ecparam -out private.key -name prime256v1 -genkey openssl req -new -sha256 -key private.key -nodes -out request.csr
-
In the "Apple Pay on the Web" section, "Add Domain" under "Merchant Domains" and follow the instruction to verify your domain ownership
-
Under "Apple Pay Merchant Identity", click on "Create Certificate".
-
In order to create the Certificate Signing Request(CSR), run the following command (make sure you have
openssl
installed).openssl req -sha256 -nodes -newkey rsa:2048 -keyout applepaytls.key -out applepaytls.csr
-
Upload the
applepaytls.csr
file to the File Upload in the Apple Developer portal. -
Store the
applepaytls.key
file to theserver/resources
directory. -
With the
merchant_id.cer
file received from Apple, run the following command to generate a.pem
file.openssl x509 -inform der -in merchant_id.cer -out applepaytls.pem
-
Store the
applepaytls.pem
file to theserver/resources
directory. -
Start the application
npm start