Skip to main content

Configuration

Apple Pay requires some configuration in your Apple Developer Account and you application:

Enable Apple Pay#

Visit your Apple Developer Account and associate Apple Pay with your app. In your App ID Configuration:

  1. Check the Enabled box in the capability for "Apple Pay Payment Processing".
  2. Click the Configure button to create a Merchant Idenfitier.
  3. Click the Create Certificate button under Apple Pay Payment Processing Certificate.
  4. 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:

  1. Open the Keychain Access app
  2. Within the Keychain Access drop down menu, select Keychain AccessCertificate AssistantRequest a Certificate from a Certificate Authority.
  3. In the User Email Address field, enter your email address.
  4. Choose Request IsSaved to disk.
  5. Check the box marked Let me specify key pair information.
  6. Click Continue.
  7. Choose a location to save.
  8. Choose ECC as the Algoritm.
  9. Choose a key size of 256 bits.
  10. Click Continue.
  11. Click Download.
  12. Save the apple_pay.cer file.

NOTE: You should open the apple_pay.cer in Keychain Access, right click it, choose Export ..., exporting as a p12 file with a name like apple-pay-processing.p12 and provide a password. A p12 file 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:

  1. Click the Configure button next to the Apple Pay Payment Processing capability.
  2. Click the Add Domain button.
  3. Specify the fully qualified domain name of the website you will invoke Apple Pay from. (Eg www.my-company.com).
  4. 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:

  1. Click the Create Certificate button.

You will need to open a Certificate Signing Request (CSR):

  1. Open the Keychain Access app.
  2. Within the Keychain Access drop down menu, select Keychain AccessCertificate AssistantRequest a Certificate from a Certificate Authority.
  3. In the User Email Address field, enter your email address.
  4. Choose Request IsSaved to disk.
  5. Click Continue.
  6. 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 in Keychain Access, right click it, choose Export ..., exporting as a p12 file with a name like apple-pay-merchant-id.p12 and provide a password. A p12 file 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:

  1. Select your App from the left pane.
  2. Choose Signing & Capabilities.
  3. Click the + icon (next to All).
  4. Double click Apple Pay.
  5. 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.