Apple Pay Setup
Configure Apple Pay for contactless payments via Square.
1. Create Merchant ID
- Go to Apple Developer Portal
- Navigate to Certificates, Identifiers & Profiles → Identifiers
- Click + → Select Merchant IDs
- Create:
merchant.com.staccato.coffee - Click Register
2. Create Payment Processing Certificate
- Select your merchant ID
- Click Create Certificate under Apple Pay Payment Processing Certificate
- Answer “Will payments be processed exclusively in China?” → No
- Generate a CSR (Certificate Signing Request) from Keychain Access:
- Open Keychain Access → Certificate Assistant → Request a Certificate
- Save to disk
- Upload CSR to Apple
- Download the
.cercertificate
3. Upload to Square
- Go to Square Developer Dashboard
- Select your application
- Navigate to Apple Pay
- Upload the payment processing certificate
- Square will validate and enable Apple Pay
4. Configure Xcode
The entitlement is already configured in StaccatoCoffee.entitlements:
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.com.staccato.coffee</string>
</array>If you use a different merchant ID, update:
- The entitlements file
ApplePayService.swift→merchantIdentifier
5. Verify in Code
The merchant ID is used in ApplePayService:
private let merchantIdentifier = "merchant.com.staccato.coffee"Supported networks:
- Visa
- Mastercard
- American Express
- Discover
Testing
- Simulator: Limited Apple Pay support — test basic flow
- Device: Add test cards to Wallet in sandbox environment
- Sandbox: Use Square sandbox credentials for test transactions
- Apple Pay sandbox cards don’t charge real money
Troubleshooting
“Apple Pay not available”
- Check device supports Apple Pay (
PKPaymentAuthorizationController.canMakePayments()) - Verify at least one card is in Wallet
- Ensure region supports Apple Pay
“Merchant ID not found”
- Verify entitlement matches the merchant ID in Apple Developer Portal
- Re-download provisioning profile after adding capability
“Certificate error”
- Ensure the payment processing certificate is uploaded to Square (not the merchant certificate)
- Certificate must match the merchant ID