Configuration
Apple Pay requires some configuration in your Apple Developer Account and you application:
- Enable Apple Pay for your App ID
- Create a Processing Certificate
- Create a Merchant Identity Certificate (if your app is deployed to the web)
- Add the Apple Pay Capability
Enable Apple Pay#
Visit your Apple Developer Account and associate Apple Pay with your app. In your App ID Configuration:
- Check the
Enabledbox in the capability for "Apple Pay Payment Processing". - Click the
Configurebutton to create aMerchant Idenfitier. - Click the
Create Certificatebutton underApple Pay Payment Processing Certificate. - You will be asked to upload a certificate signing request.
Processing Certificate#
NOTE: The documentation provided by Apple is incorrect and you will get an error
Incorrect CSR Key Pair - Expected a Key Pair with ECC Algorithm and key size of 256 bits. Create a new CSR and try again..
Follow these instructions to create a CSR for Apple Pay:
- Open the
Keychain Accessapp - Within the Keychain Access drop down menu, select
Keychain Access→Certificate Assistant→Request a Certificate from a Certificate Authority. - In the User Email Address field, enter your email address.
- Choose
Request Is→Saved to disk. - Check the box marked
Let me specify key pair information. - Click
Continue. - Choose a location to save.
- Choose
ECCas the Algoritm. - Choose a key size of
256 bits. - Click
Continue. - Click
Download. - Save the
apple_pay.cerfile.
NOTE: You should open the
apple_pay.cerinKeychain Access, right click it, chooseExport ..., exporting as ap12file with a name likeapple-pay-processing.p12and provide a password. Ap12file contains both the certificate and private key and allows its use on a computer other than your own.
Merchant Identity Certificate#
In your App ID Configuration:
- Click the
Configurebutton next to theApple Pay Payment Processingcapability. - Click the
Add Domainbutton. - Specify the fully qualified domain name of the website you will invoke Apple Pay from. (Eg
www.my-company.com). - Click
Download. You will need to verify ownership of the domain by uploading this file to the.well-knownfolder.
Create a Merchant Identity Certificate:
- Click the
Create Certificatebutton.
You will need to open a Certificate Signing Request (CSR):
- Open the
Keychain Accessapp. - Within the Keychain Access drop down menu, select
Keychain Access→Certificate Assistant→Request a Certificate from a Certificate Authority. - In the User Email Address field, enter your email address.
- Choose
Request Is→Saved to disk. - Click
Continue. - Choose a location to save.
On the Apple Developer Page:
- Click
Download - Save the
merchant_id.cerfile
NOTE: You should open the
merchant_id.cerinKeychain Access, right click it, chooseExport ..., exporting as ap12file with a name likeapple-pay-merchant-id.p12and provide a password. Ap12file contains both the certificate and private key and allows its use on a computer other than your own.
Apple Pay Capability#
Your application needs the Apple Pay Capability added and associated to the Merchant Identifier you created.
Open your project in XCode and:
- Select your App from the left pane.
- Choose
Signing & Capabilities. - Click the
+icon (next toAll). - Double click
Apple Pay. - Click the checkbox next to the Merchant ID you created.
Without the Apple Pay capability assigned to a Merchant ID you will get an error when makePaymentRequest is called.
Certification Expiration#
Certificates expire in around 2 years so be sure to setup a reminder to renew the certificate before expiration. The expiration date can be found in the Certifcates section of the Apple Developer portal.