TABLE OF CONTENTS
- Overview
- Prerequisites
- Use Case 1: Creating a Merchant ID in Apple Developer Portal
- Use Case 2: Configuring Payment Processing Certificate
- Use Case 3: Configuring Merchant Identity Certificate
- Payment Flow Summary
- Best Practices
- Summary
Overview
This article provides a complete, developer-focused guide to configuring Apple Pay in Znode using Spreedly. It covers Apple Developer setup, certificate generation, and integration steps required to enable secure Apple Pay transactions on the Storefront.
Apple Pay integration requires configuration across three components:
- Apple Developer Portal (Merchant setup and certificates)
- Spreedly (payment orchestration and decryption)
- Znode Admin Console (certificate configuration)
Prerequisites
Apple Requirements
- Active Apple Developer account with Apple Pay entitlement enabled
- Access to Certificates, Identifiers & Profiles
Spreedly Requirements
- Active Spreedly account
- Environment Key and Access Secret
- Configured payment gateway (such as Authorize.Net or CyberSource)
Storefront Requirements
- HTTPS-enabled publicly accessible domain
- Apple Pay-compatible Storefront (Safari on iOS/macOS)
System Requirements
- OpenSSL installed and available via command line
- PowerShell access
Use Case 1: Creating a Merchant ID in Apple Developer Portal
The Merchant ID uniquely identifies your business for Apple Pay transactions.
Steps
- Sign in to the Apple Developer Portal.
- Navigate to Certificates, Identifiers & Profiles.
- Select Identifiers.
- Click Add (+) to create a new identifier.
- Select Merchant IDs and continue.
- Enter a description for the Merchant ID.
- Enter the identifier in the format:
merchant.<your-domain> - Click Register.
Expected Outcome
- Merchant ID is created successfully and visible in the Apple Developer Portal
- Certificate configuration sections become available
Notes
- Merchant IDs must be globally unique
- Merchant IDs cannot be modified after creation
Use Case 2: Configuring Payment Processing Certificate
This certificate is used by Spreedly to decrypt Apple Pay payment tokens.
Steps
Step 1: Prepare Environment
- Create a working directory (for example:
D:\ApplePay). - Download the PowerShell script:
generate_apple_pay_payment_processing_certificate.ps1
- Ensure OpenSSL is installed and accessible.
- Open PowerShell and navigate to the directory.
Step 2: Execute Script
.\generate_apple_pay_payment_processing_certificate.ps1
If execution is blocked:
powershell.exe -ExecutionPolicy Bypass -File .\generate_apple_pay_payment_processing_certificate.ps1
Step 3: Provide Inputs
- Spreedly Environment Key
- Spreedly Access Secret
- Email address
- Optional Common Name and Output File Name
Step 4: Upload CSR to Apple
- Open Merchant ID in Apple Developer Portal
- Under Payment Processing Certificate, click Create Certificate
- Upload the generated CSR file
- Download the issued
.cercertificate
Step 5: Resume Script
- Return to PowerShell
- Enter the certificate file name when prompted
Step 6: Automatic Processing
- Converts
.certo.pem - Uploads certificate to Spreedly
- Saves the PEM file locally
Expected Outcome
- Certificate status shows Active in Apple Developer Portal
- Script execution completes successfully
Generated Files
apple-pay-payment-processing.csrapple-pay-payment-processing.pem
Use Case 3: Configuring Merchant Identity Certificate
This certificate is used during Apple Pay merchant validation.
Steps
Step 1: Generate CSR and Private Key
.\generate_apple_pay_merchant_identity_certificate.ps1
If execution is blocked:
powershell.exe -ExecutionPolicy Bypass -File .\generate_apple_pay_merchant_identity_certificate.ps1
Step 2: Generate Certificate in Apple
- Navigate to Merchant ID in Apple Developer Portal
- Click Create Certificate under Merchant Identity Certificate
- Upload CSR file
- Download the
.cerfile
Step 3: Convert Certificate
- Enter certificate file name when prompted
- Script outputs:
apple-pay-merchant-certificate.pem
Step 4: Configure in Znode Admin Console
- Upload:
- Merchant Identity Certificate:
apple-pay-merchant-certificate.pem - Merchant Identity Private Key:
apple-pay-private-key.pem
- Merchant Identity Certificate:
Expected Outcome
- Znode completes successful merchant validation during Apple Pay transactions
Payment Flow Summary
Supported Platforms
- Safari browser
- iPhone (iOS)
- Mac (macOS)
Transaction Flow
Merchant Validation
- User clicks Apple Pay button
- Frontend sends validation request to backend
- Backend validates using Merchant ID, domain, and certificate
- Apple returns merchant session
- Apple Pay interface is displayed
Payment Authorization
- User authorizes payment
- Apple generates encrypted payment token
- Token sent to backend
- Backend forwards token to Spreedly
- Spreedly decrypts token
- Payment submitted to gateway
- Gateway returns success or failure
- Result displayed to user
Common Errors and Troubleshooting
Script Execution Blocked
Issue: PowerShell prevents execution.
Resolution:
powershell.exe -ExecutionPolicy Bypass -File <script-name>
Certificate Not Active
Resolution:
- Verify correct CSR upload
- Re-run script if required
Apple Pay Not Displayed
- Ensure Safari browser is used
- Verify supported device
- Check Merchant ID and domain configuration
Best Practices
- Store certificate files securely
- Maintain consistent naming conventions
- Monitor certificate expiration dates
- Use separate environments for development and production
Summary
With this configuration:
- Apple manages merchant identity and trust
- Spreedly handles token decryption
- Znode manages validation and transaction orchestration
This ensures secure, compliant Apple Pay transactions within the Storefront.