ConfigurationApple Pay Setup

Apple Pay Setup

Configure Apple Pay for contactless payments via Square.

1. Create Merchant ID

  1. Go to Apple Developer Portal
  2. Navigate to Certificates, Identifiers & Profiles → Identifiers
  3. Click + → Select Merchant IDs
  4. Create: merchant.com.staccato.coffee
  5. Click Register

2. Create Payment Processing Certificate

  1. Select your merchant ID
  2. Click Create Certificate under Apple Pay Payment Processing Certificate
  3. Answer “Will payments be processed exclusively in China?” → No
  4. Generate a CSR (Certificate Signing Request) from Keychain Access:
    • Open Keychain Access → Certificate Assistant → Request a Certificate
    • Save to disk
  5. Upload CSR to Apple
  6. Download the .cer certificate

3. Upload to Square

  1. Go to Square Developer Dashboard
  2. Select your application
  3. Navigate to Apple Pay
  4. Upload the payment processing certificate
  5. 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:

  1. The entitlements file
  2. 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