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 PayVisit your Apple Developer Account and associate Apple Pay with your app. In your App ID Configuration:
- Check the
Enabled
box in the capability for "Apple Pay Payment Processing". - Click the
Configure
button to create aMerchant Idenfitier
. - Click the
Create Certificate
button underApple Pay Payment Processing Certificate
. - You will be asked to upload a certificate signing request.
#
Processing CertificateNOTE: 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 Access
app - 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
ECC
as the Algoritm. - Choose a key size of
256 bits
. - Click
Continue
. - Click
Download
. - Save the
apple_pay.cer
file.
NOTE: You should open the
apple_pay.cer
inKeychain Access
, right click it, chooseExport ...
, exporting as ap12
file with a name likeapple-pay-processing.p12
and provide a password. Ap12
file contains both the certificate and private key and allows its use on a computer other than your own.
#
Merchant Identity CertificateIn your App ID Configuration:
- Click the
Configure
button next to theApple Pay Payment Processing
capability. - Click the
Add Domain
button. - 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-known
folder.
Create a Merchant Identity Certificate:
- Click the
Create Certificate
button.
You will need to open a Certificate Signing Request (CSR):
- Open the
Keychain Access
app. - 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.cer
file
NOTE: You should open the
merchant_id.cer
inKeychain Access
, right click it, chooseExport ...
, exporting as ap12
file with a name likeapple-pay-merchant-id.p12
and provide a password. Ap12
file contains both the certificate and private key and allows its use on a computer other than your own.
#
Apple Pay CapabilityYour 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 ExpirationCertificates 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.