web-payments-example
web-payments-example copied to clipboard
Demo for Payment Request API and Apple Pay for the Web API
Web Payments Example
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).
Set up Apple Pay merchant account
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
opensslinstalled).openssl req -sha256 -nodes -newkey rsa:2048 -keyout applepaytls.key -out applepaytls.csr -
Upload the
applepaytls.csrfile to the File Upload in the Apple Developer portal. -
Store the
applepaytls.keyfile to theserver/resourcesdirectory. -
With the
merchant_id.cerfile received from Apple, run the following command to generate a.pemfile.openssl x509 -inform der -in merchant_id.cer -out applepaytls.pem -
Store the
applepaytls.pemfile to theserver/resourcesdirectory. -
Start the application
npm start