ConfigurationSquare Setup

Square Setup

Square handles payment processing for Staccato via Edge Functions.

Create Square Application

  1. Go to Square Developer Dashboard
  2. Click ”+ Create New Application”
  3. Name it “Staccato Coffee”
  4. Click Create

Get Credentials

From your Square application dashboard:

CredentialWhere to FindUse
Application IDApplication → CredentialsAppConfig.squareApplicationId
Access TokenApplication → Credentials → Sandbox/ProductionEdge Function secret
Location IDApplication → Locations tabAppConfig.squareLocationId

Sandbox vs Production

EnvironmentApplication ID PrefixUse
Sandboxsandbox-sq0idb-...Development and testing
Productionsq0idp-...Live payments

The app auto-selects sandbox in #if DEBUG builds.

Sandbox Test Values

Use these for testing without real charges:

  • Card nonce: cnon:card-nonce-ok
  • Card nonce (declined): cnon:card-nonce-declined

Configure Edge Functions

# Set Square secrets for Edge Functions
supabase secrets set SQUARE_ACCESS_TOKEN=your_sandbox_access_token
supabase secrets set SQUARE_LOCATION_ID=your_location_id
 
# Deploy functions
supabase functions deploy process-payment
supabase functions deploy sync-square-order
 
# Verify deployment
supabase functions list

Configuration Check

The SquarePaymentService checks if Square is properly configured:

private var isConfigured: Bool {
    AppConfig.squareApplicationId != "sandbox-sq0idb-DEMO"
        && AppConfig.squareLocationId != "your-location-id"
}

When not configured in debug mode, payments are simulated with a 500ms delay. In release mode, it falls back to “Pay at Counter”.

Apple Pay with Square

To accept Apple Pay through Square:

  1. Create merchant ID in Apple Developer Portal
  2. Generate payment processing certificate
  3. Upload certificate to Square Dashboard → Apple Pay
  4. See Apple Pay Setup for details