Apple Pay
In this guide we will show you how to enable Apple Pay in just a few short steps. Since the steps require using Keychain, they must be performed on a Mac.
Setup a Merchant ID​
Apple Pay requires that you create a Merchant ID that will be associated with your app's bundle ID.
Generate a Merchant ID​
Register a Merchant ID via the Apple Provisioning Portal.
- Go to the Apple Developer dashboard and log in.
- Navigate to
Identifiers
. - Click the blue
+
sign button that is next to theIdentifiers
page title. This will take you to the "Register a New Identifier" page. - Select
Merchant IDs
and clickContinue
. - Provide a description and ID. A typical convention for the ID is
merchant.com.<your_apps'_bundle_id>
. - Click
Continue
and if the information looks good, clickregister
.
Link the Merchant ID to Your Bundle ID​
After registering a Merchant ID, you will then need to enable Apple Pay for your game’s App ID on the Apple Developer Dashboard.
- Go back to the
Identifiers
page. - Find the bundle ID for your app, and click it to be taken to the "Edit your App ID Configuration" page.
- Check the checkbox that is next to the "Apple Pay Payment Processing" item under the "Capabilities" section.
- Click the now enabled "Edit" button to bring up a list of available Merchant IDs.
- Find the Merchant ID that was created earlier and check it.
Create a Payment Processing Certificate​
Next, a Payment Processing Certificate must be created.
Make a Certificate Signing Request (CSR)​
You will need to generate a Certificate Signing Request file with specific key pair settings using Keychain Access.
- On your Mac, open
Keychain Access
. - In the menu bar go to
Keychain Access
>Certificate Assistant
>Request a Certificate from a Certificate Authority...
. - Input your preferred email address.
- Select
Saved to Disk
. - Check
Let me specify key pair information
. - Press
Continue
. - Choose a location to save the
.certSigningRequest
file, and give it a name. - Select Algorithm
ECC
. - Select Key Size
256 Bits
. - Press
Continue
.
NOTE: You must select
ECC
before the256 Bits
option becomes available.
Generate the Certificate​
Now generate your certificate using the CSR you generated via Keychain Access earlier.
- On the Apple Developer dashboard navigate to Certificates.
- Click the blue
+
sign next to the "Certificates" page title. This will take you to the "Create a New Certificate" page. - Select
Apple Pay Payment Processing Certificate
and clickContinue
. - Select the Merchant ID you created and click
Continue
. - Under "Apple Pay Payment Processing Certificate" click
Create Certificate
. - You may be taken to a page "Edit or Configure Merchant ID" - which asks "Will payments associated with this Merchant ID be processed exclusively in China?". Skillz does not operate in China. So answer
no
, then clickContinue
. - On the "Create a New Certificate" page upload the
.certSigningRequest
from the first section. ClickContinue
. - You will be taken to a confirmation page titled "Download Your Certificate". Make sure to press the
Download
button and save your certificate file.
Download the resulting certificate file (.cer
), which you will turn into a .p12
file in the next step.
Upload to the Developer Console​
You now need to upload a copy of your Payment Processing Certificate to the Skillz Developer Console.
Export the Certificate as a .p12​
The certificate you have downloaded is a .cer
file, which you will need to export as a .p12 file before uploading to Skillz.
- Once you have downloaded the
.cer
, openKeychain Access
on your computer. - Import the certificate you created in the previous step by selecting
File -> Import
Items. - Select the Certificates category.
- Select your game’s APNS certificate:
- Select
File -> Export
Items. - Save as a
Personal Information Exchange (.p12)
file. - You will be prompted to create a password. Make note of this password, as you will need it when you upload to Skillz.
- Save the file in a secure place so that you can retrieve it later.
After you create a .p12
file from the Apple provided .cer
, you can upload the .p12
file and provide the password to Skillz on our Apple Pay page under the Configuration section.
Update Your Xcode Project​
For final steps, your Xcode project will need to be updated.
Update the Entitlements File in Xcode​
You will now need to update your entitlements file in Xcode to enable Apple Pay in your binary.
Begin by regenerating and re-downloading the provisioning profiles for your game in the Apple Provisioning Portal. This will ensure they have all updated information regarding Apple Pay. In Xcode, open the "Signing and Capabilities" tab for your game’s target, click the + Capability
button and select Apple Pay. Finally, select the Merchant ID you created earlier.
Confirm the proper entry has been added to the entitlements file for your game.
Add PassKit to Your Xcode Project​
Finally, add PassKit as a weakly linked framework to your project. To do so, select PassKit in the Link Binary With Libraries
section of your project’s Build Phases and mark it as Optional.
Test Apple Pay​
You should now be able to complete a deposit via Apple Pay.
When testing Apple Pay, be sure that:
- You are on a device that supports Apple Pay
- You have Apple Pay setup on your device
- The credit card on file is supported by Skillz (Visa, Mastercard)
NOTE: We only show the Apple Pay button to players if they meet the above conditions.
You will then need to test Apple Pay using a real credit card. Your card will not be charged as long as the game is running in the Sandbox
environment. You can use this credit card number when testing in Skillz's Sandbox environment.
Updating Your Apple Pay Certificate​
Apple requires you to update your Apple Pay certificate every 25 months. If you received an email from Skillz or Apple stating that your current certificate will expire soon, follow the steps below to ensure Apple Pay continues to work in your title.
Generate a New Certificate​
- Following the steps above, create a new apple pay certificate
NOTE: you should NOT create a new merchant ID for your title. Doing so will disrupt the existing apple pay service in your title
- In the Apple Developer Console, click
ACTIVATE
on your newly created certificate - Download your certificate and export it as a
.p12
file per the instructions above - Upload your new
.p12
file to the Skillz Developer Console. Be sure it is set as enabledNOTE: Apple does not immediately start using your newly activated certificate. In order to minimize the duration of time Apple Pay does not work in your title, WAIT to upload your newly created
.p12
file to Developer Console until AFTER Apple confirms via email that your old certificate has been revoked
Troubleshooting​
Not seeing the Apple Pay button? Make sure you've done the following:
- Enabled Apple Pay your app ID in your Apple Developer account.
- Created a Merchant ID and linked it to your app's bundle ID.
- Generated a Payment Processing Certificate.
- Provided the correct password for your p12 to the Developer Console.
- Regenerated your provisioning profile.
- Updated your Xcode project with the regenerated provisioning profile.
- Added the "Apple Pay" capability in your Xcode project with the Merchant ID selected.
Inspect the Game IPA file for the In App Payments
Entitlement​
If you did all the above steps and you still cannot see the Apple Pay, perhaps you should inspect your game's IPA file and see if the In App Payments
entitlement is present.
Note: Let's assume that your IPA is in the ~/Downloads
folder and it's called DiamondStrike.ipa
.
Follow these steps to extract the IPA files:
# Unzip the IPA to the DiamondStrike folder
unzip ~/Downloads/DiamondStrike.ipa -d ~/Downloads/DiamondStrike
Now, you can use the codesign
command to extract the entitlements from the app:
# Extract entitlements from the app
codesign -d --entitlements :- ~/Downloads/DiamondStrike/Payload/DiamondStrike.app | xmllint --format -
If done correctly, the above command will spit out XML text similar to the following (keep in mind that the output you get is unique to you):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<false/>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.team-identifier</key>
<string>YOUR_TEAM_IDENTIFIER_GOES_HERE</string>
<key>application-identifier</key>
<string>YOUR_TEAM_IDENTIFIER_GOES_HERE.com.pocketcandy.diamondstrikefree</string>
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.com.skillz.diamondstrike</string>
</array>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:skillz.com</string>
<string>applinks:dl.skillz.com</string>
</array>
</dict>
</plist>
If you don't see the <key>com.apple.developer.in-app-payments</key>
line, this means that the In App Payments entitlement is not present in your app.
If that's the case, then you should try the following steps to attempt to enable Apple Pay:
- Regenerate your provisioning profile.
- Update your Xcode project with your provisioning profile.
- Create a new IPA with your provisioning profile.
- Check for the In App Payments entitlement in the IPA using the steps mentioned above.
If you see the In App Payments entitlement, you should be ready to follow the steps in Test Apple Pay to test that Apple Pay works in your device.