Take payments with Apple Pay in your app
Have an Agent register a merchant ID, turn on Apple Pay for your app, and make the payment processing certificate from the file your payment provider gives you.
Apple Pay lets people pay in your app with the cards in their Wallet. On your Apple team, the app needs three things: a merchant ID, which names you as the seller; the Apple Pay capability, turned on for the app; and a certificate for the merchant ID. Your payment provider, the company that charges the card, tells you which certificate it needs, and may give you a file to make it from. Your Agents do the Apple side.
Before you start
- The Team’s owner has connected an Apple Developer account and switched a team on. See Connect your Apple Developer account.
- The app has a Bundle ID, which it gets on its first build. See Find your app’s Bundle ID and its last build.
- You have a payment provider that takes Apple Pay, and its Apple Pay instructions. Apple’s Apple Pay planning ↗ page explains how payment providers fit in.
Register a merchant ID
Ask in the Project’s chat, for example:
Register a merchant ID for Apple Pay called "Notes Shop" with the identifier merchant.com.example.notes.The Agent registers it with asc merchant-ids create, which takes an identifier and a name. The command’s help gives merchant.com.example as an example of an identifier. Apple’s Configure Apple Pay ↗ page says a merchant ID never expires and one can serve several apps, so if you already have one, ask “Which merchant IDs does my Apple team have?” first. The Agent lists them with asc merchant-ids list.
Turn on Apple Pay for the app
Ask, for example:
Add Apple Pay to the app with the merchant ID merchant.com.example.notes. Put a Pay button on the checkout screen.The Agents add the capability to the app and turn it on for the app’s App ID (Apple calls it Apple Pay Payment Processing), then build the app again. What changes, and how to check it, is in Turn on iCloud, App Groups or another capability.
asc has no command that links a merchant ID to an App ID, and this page doesn’t know whether turning on the capability links it. Check in your Apple Developer account that the merchant ID is selected for the app’s Apple Pay capability; Apple’s Enable app capabilities ↗ page shows where. If you change it there, ask the Agents to build again so the app’s provisioning profile picks it up.
Make the payment processing certificate
The certificate Apple returns pairs with the private key the certificate signing request (CSR) was made from. Who holds that key depends on who makes the request.
From your payment provider’s file
-
Get the CSR file from your payment provider, as its Apple Pay instructions say.
-
Attach the file to a message in the Project’s chat, as it is. See Send photos, files and sketches to an Agent.
-
Ask, for example:
Make the Apple Pay payment processing certificate for merchant.com.example.notes from the attached CSR, and send me the certificate file. -
The Agent makes the certificate with
asc merchant-ids certificates create(orasc certificates create) from your file. Apple’s answer includes the certificate, so the Agent can save it as a file and send it to you in the chat. The certificate (a.cerfile) isn’t secret, so the chat is fine for it. -
Upload the certificate to your payment provider, as its instructions say.
The private key stays with your payment provider, and nothing secret comes back to the chat.
Without a file
If your payment provider’s instructions don’t give you a CSR file, the Agent can make the private key and the request itself (--generate-csr). Then the key is yours to keep, not your provider’s, and the command’s help says to keep it out of the repository and out of logs.
Ask the Agent to save the key in a folder the project’s .gitignore leaves out, such as secrets/, and to tell you its path. That keeps it out of the repository, a shared link and an export of the source. It still shows in Files, dimmed, where anyone in the Team can open it. To take a copy for your server or your payment provider, open it in Files and use Export (see Find the files and documents Agents made), or ask the Agent to send it to you in your DM with that Agent (see Create group chats and talk to one Agent), then touch and hold the file (on the Mac, right-click it) and choose Save As…. Don’t ask for the key in the Project’s chat: everyone in the chat can open it, and you can’t recall a message the Agent sent.
Which certificate
asc makes four kinds of Apple Pay certificate, each for one merchant ID: APPLE_PAY, APPLE_PAY_RSA, APPLE_PAY_MERCHANT_IDENTITY and APPLE_PAY_PSP_IDENTITY. Its help names them without saying which is which. Tell the Agent the name your payment provider uses for the one it wants. Apple’s Configure Apple Pay ↗ page describes the payment processing certificate, and says it expires every 25 months.
Try it on a device
Check Apple Pay on a real iPhone or iPad, with a build made after the capability was turned on. See Turn on iCloud, App Groups or another capability. This page doesn’t know whether the Apple Pay sheet works in Preview.
If the sheet doesn’t open or a payment fails, tell the Agent what you saw in the chat, with a screenshot.
See, change or remove
| Ask | asc |
|---|---|
| “Which certificates does merchant.com.example.notes have, and when do they expire?” | merchant-ids certificates list |
| “Rename the merchant ID to Notes Store.” | merchant-ids update --name |
| “Delete the merchant ID merchant.com.example.old.” | merchant-ids delete, only with --confirm, so the Agent asks you first. |
| “Revoke the old payment processing certificate.” | Agents can’t: revoking is your step in your Apple Developer account. See Apple’s Revoke a certificate ↗. |
Questions
Can I set this up in AirBuild without an Agent?
Can I take Apple Pay on my website too?
asc can make a merchant identity certificate (APPLE_PAY_MERCHANT_IDENTITY), but it has no command that registers your website’s domain for Apple Pay. See Apple’s Configure Apple Pay on the web ↗.Can I sell subscriptions or in-app content with Apple Pay?
Can an Agent make other certificates this way?
asc certificates create makes only Wallet pass and Apple Pay certificates. Asked for another kind, it says the type “is a signing certificate, which Airbuild manages”: AirBuild holds your team’s signing certificates and signs your builds with them itself. For Wallet passes, see Make Wallet passes for your app.