This document is intended to help you to integrate Apple Pay from the merchant ID creation to the first transaction.
If you are not sure how Apple Pay works, we invite you to visit our How it works section on this documentation.
Note: Apple Pay doesn't have sandbox environment, meaning that you won't be able to perform transactions with our test cards. In order to test Apple Pay transactions, you should point to live environment and use live cards. We recommend to perform pre-authorizations in order to not be charged, or card payments, refunding the complete amount through Dashboard (in History section) or API call.
Create a merchant ID
Note: We recommend creating a Merchant ID for each Merchant (i.e. business) accepting payments within your app.
- Access your Apple Developer Account and visit the 'Certificates, Identifiers & Profiles' section of the Apple member center. You can then navigate to 'Merchant IDs' and click 'add.'
Set your Merchant ID. The identifier you enter should be a reverse DNS style identifier prefixed with the word
Create an Apple Pay certificate
- Request a 'certificate signing request' (CSR file) from Judopay by emailing firstname.lastname@example.org.
When you’ve received your 'certificate signing request', you’ll need to proceed with creating your Apple Pay certificate. You can do this within the Apple member center either under 'Certificates > All' or from the Merchant ID page.
The first screen will describe how to manually create your certificate signing request. As you’ve already obtained this from Judopay, you can click 'Continue'.
Apple will ask you if you are processing transactions outside of the United States. At this point, you should select "No".
You’ll then be prompted to upload the CSR file provided by Judopay and then click 'Generate'. You should then receive confirmation that your certificate is ready:
- You’ll need to download this certificate and send it to Judopay in order to complete your Apple Pay set-up. When we’ve received this certificate, we’ll add it to your account and notify you to confirm it’s been added.
Note: Apple Certificates expire slightly over two years after generation, e.g. a certificate generated on 13th May, 2015 will expire on the 11th June 2017. To generate a new certificate you can simply follow the above steps again.
Setup your Apple Pay entitlement
Apple Pay is built into the PassKit framework, but it has it’s own entitlement which you’ll need to configure. You can do this by selecting your build Target and then selecting ‘Capabilities’ as shown below:
Once you’ve enabled the entitlement, you’ll need to add the Merchant ID you created earlier to the app (you may need to refresh the list):
When you’ve done this, we recommend opening the entitlements file to confirm the Merchant ID has been added to your app:
And that’s it! Your account is now ready to process Apple Pay payments with Judopay. You can configure the Judopay SDK to proceed making payments by following the tutorial below.
Check for Apple Pay support
Apple Pay is not supported on all Apple devices. Before invoking any Apple Pay functionality within your app, you’ll need to test if it’s supported on the device.
Apple provide two methods for performing these checks:
- You can use [PKPaymentAuthorizationViewController canMakePayments] to check if the user’s device supports Apple Pay and has it enabled. This check will query both the device hardware and whether Apple Pay is enabled in the user’s region.
- Using [PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks] provides a more detailed check to query whether a user has a registered card with particular card schemes. This check is useful if you don’t accept all card types.
Both methods are explained in detail in the Apple developer documentation here.
Perform a payment
Use the live environment for testing Apple Pay before deploying your app to the public. Please consult the best test practices in our live environment guide. Here some highlights:
- Make sure that you have completed the account setup for Apple Pay.
- Ensure that the SDK you are using is properly configured for live environment as per the ‘Point to live environment’ section for ObjC or Swift.
- Use always real debit or credit cards. The test cards provided won’t work in this environment.
- Test all the payment scenarios and security features you require to verify the expected behaviour.
Test live payments
Create a payment intent with the required extras as per the following guides, depending on the SDK used in your integration:
Completed the above? You are ready to go.
If you need additional support or something didn’t go as expected, please contact us.