PaySwitcher
  • About PaySwitcher
    • 🛒For Online Businesses
    • 🪜For Small & Medium Enterprises
    • 🏢For Enterprises
    • 🖥️For SaaS Providers
    • 🛍️For E-Commerce Businesses
    • 📦For Marketplace/Platforms
    • 🏦For Banks & Financial Institutions
  • PaySwitcher Cloud
    • ⚡Quickstart
      • 📥Migrate from Stripe
        • Web
        • Android
        • iOS
        • React Native
      • 🥗Payment Recipes
        • Use PayPal With Stripe
    • ⚙️Control Centre Account setup
    • 📦Integration guide
      • 🌐Web
        • Node And React
        • Customization
        • Error Codes
        • Node and HTML
        • Vanilla JS and REST API Integration
      • 📱Android
        • Kotlin with Node Backend
        • Customization
        • Features
      • 📱iOS
        • Swift with Node Backend
        • Customization
        • Features
      • ⏺️React Native
        • React Native with Node Backend (Beta)
        • Card Widget (Beta)
        • Customization
      • ⏺️Flutter
        • Flutter with Node Backend
        • Customization
      • Headless SDK
      • Payment Methods Management
    • 💳Payment methods setup
      • 💳Cards
      • 📱Wallets
        • Apple Pay
          • Web Domain
          • iOS Application
        • Google Pay
        • PayPal
      • 📆Pay Later
      • 🏦Banks
        • Bank Debits
        • Bank Redirects
        • Bank Transfers
      • 🪙Crypto
      • 🔑Test Credentials
    • 🔌Connectors
      • 🖲️Available Connectors
        • ACI
        • Adyen
        • Airwallex
        • Authorizedotnet
        • Bambora
        • Bank of America
        • Billwerk
        • Bluesnap
        • Braintree
        • Checkout
        • Coinbase
        • Cybersource
          • Apple Pay
          • Google Pay
        • dLocal
        • Fiserv
        • GlobalPayments
        • GoCardless
        • Klarna
        • Mollie
        • MultiSafepay
        • Nuvei
        • OpenNode
        • Paypal
        • PayU
        • Prophetpay
        • Rapyd
        • Shift4
        • Stripe
        • TrustPay
        • Volt
        • Worldline
        • Worldpay
        • Zen
      • Activate connector on PaySwitcher
      • Test a Payment with connector
    • 🪝Webhooks
  • Features
    • 🔀Payment flows
      • 🔁Saving payment methods & recurring payments
      • 💵Payouts
        • ➕Get started with payouts!
        • 🔗Process payouts using saved payment methods
        • 🛣️Route your payout transactions using Smart Router
        • ♻️Smart Retries in Payout
        • 🔗Payout links
      • 0️ 0️ 0️ Zero Amount Authorization
      • 🔓Tokenization & saved cards
      • 🔗Payment links
      • ⏭️External Authentication for 3DS
      • 💰Manual Capture
      • 🛑Fraud Blocklist
      • 🔁Subscriptions
      • 🔃PG Agnostic Recurring Payments
    • 🕹️Merchant controls
      • 🛣️Smart Router
        • Rule Based Routing
        • Volume Based Routing
        • Default Fallback Routing
      • 🛡️Fraud & risk management
      • 🔃Smart retries
      • 🎛️Analytics & operations
      • 📋3DS decision manager
        • Setup guide
      • 📋Surcharge
        • Surcharge Setup guide
      • 🔼3DS Step-up retries
      • 🚩Disputes/Chargebacks Management
      • 🤝Reconciliation
        • Getting Started with Recon
    • 🔑Account management
      • 🔢Exporting payments data
      • 🤹Multiple accounts & profiles
      • 🛂Manage your team
    • 🛍️E-commerce platform plugins
      • WooCommerce Plugin
        • Setup
        • Compatibility
        • FAQs
  • SECURITY AND COMPLIANCE
    • 🔏Overview
    • 💳PCI Compliance
    • 🔐Data Security
    • 💽GDPR compliance
    • 🕵️Identity and Access Management
  • Learn more
    • 🍡SDK Reference
      • Node
      • React
      • JS
    • 📐PaySwitcher Architecture
      • Router
      • Storage
      • A Payments Switch with virtually zero overhead
    • 🌊Payment flows
Powered by GitBook
On this page
  • Prerequisites
  • Creating an Apple MerchantID
  • Validating Merchant Domain
  • Creating Apple MerchantID Certificate and Private Key
  • Creating Apple Pay Payment Processing Certificate
  • Configuring Apple Pay on PaySwitcher
  • Integrate with Xcode
  1. PaySwitcher Cloud
  2. Payment methods setup
  3. Wallets
  4. Apple Pay

iOS Application

Enable Apple pay on your iOS app

PreviousWeb DomainNextGoogle Pay

Last updated 11 months ago

Prerequisites

Before beginning to integrate Apple Pay with PaySwitcher, below prerequisites need to be fulfilled. Please feel free to reach out to PaySwitcher support if you are stuck at any stage when integrating and testing Apple Pay.

  1. Apple Pay requires an Apple Developer Account. You can for one here.

  2. You must have a valid SSL certificate on your domain (meaning it begins with https)

Apple Pay requires additional steps, and requires macOS 10.12.1+ or iOS 10.1+. Follow the steps given below to setting up Apple Pay -

Creating an Apple MerchantID

You can create an Apple MerchantID referencing the video or following the steps mentioned below

  • Log in to your

  • Go to the , select Merchant IDs and click Continue

  • Add a useful description (like merchant id for test environment)

  • Enter a unique descriptive identifier (like merchant.com.testdomain.sandbox) and click Continue

  • Verify the description and identifier and click on Register

Validating Merchant Domain

You can validate the merchant domain by following the steps mentioned below -

  • Under the Merchant Domains section, click on Add Domain

  • Enter your merchant_domain as domain and click on Save

  • Click on Download and a .txt file will be downloaded

  • Host this file on merchant_domain/.well-known/apple-developer-merchantid-domain-association.txt

  • Once you host the .txt file in the path mentioned above, click on Verify

  • Make sure the status is verified as shown in the following image

Creating Apple MerchantID Certificate and Private Key

You can create an Apple MerchantID certificate and private key by following the steps mentioned below -

Note: It is recommended that you keep all the generated files in the same workspace for the sake of simplicity

  • Open a terminal and create .csr and .key file using the following command -

openssl req -out uploadMe.csr -new -newkey rsa:2048 -nodes -keyout certificate_sandbox.key
  • Enter your details asked in the prompt and when asked to enter a challenge password, you can leave it as blank. You will get a .csr and .key file

  • Under the Apple Pay Merchant Identity Certificate section (make sure you are not in the Apple Pay Payment Processing Certificate section), click on Create Certificate

  • Upload the .csr file you just created by running the command (it would be called uploadMe.csr if you copy-pasted the command) and click on Continue

  • You will get a .cer file on clicking on Download (it will probably be named merchant_id.cer)

  • You will need to convert this .cer file into a .pem file using the following command -

openssl x509 -inform der -in merchant_id.cer -out certificate_sandbox.pem

Creating Apple Pay Payment Processing Certificate

  • You will need to get a .csr file from your processor's dashboard, (like Adyen, Cybersource)

  • Under the Apple Pay Payment Processing Certificate section, click on Create Certificate

  • After answering whether the Merchant ID will be processed exclusively in China mainland, click on Continue

  • Upload the .csr you received from your processor and click Continue

  • Click on the prompted Download button and you will get a .cer file, Upload this .cer file you received while creating Apple MerchantID Certificate on the processor's dashboard.

This final step is specific to the processor being used and is not necessary in Sandbox Test environment for some processors, such as Authorize.Net.

Configuring Apple Pay on PaySwitcher

You can configure Apple Pay on PaySwitcher by following the steps mentioned below -

  • In the Connectors tab, select your processor

  • While selecting Payment Methods, click on Apple Pay in the Wallet section

  • Select the iOS Certificate option

  • In Apple Merchant Identifier, add your identifier which you added while creating Apple MerchantID

  • In Merchant Certificate, base64 encode the entire content of your .pem file (it will be certificate_sandbox.pem, if you used the exact command mentioned above), and enter the encoded data in the form field. Use the below command to base64 encode it.

base64 -i certificate_sandbox.pem
  • In Merchant Private Key, base64 encode the entire content of your .key file (it will be certificate_sandbox.key, if you used the exact command mentioned above), and enter the encoded data in the Merchant PrivateKey form field. Use the below command to base64 encode it.

base64 -i certificate_sandbox.key
  • Display Name should be your merchant name that you want to present to the customers when the make ApplePay payment on your platform.

  • In Domain, enter web in the form field.

  • In Domain Name, add the verified domain name you configured in Merchant Domains in Apple Developer Account.

Note: It is mandatory for you to pass the customer's billing details for Apple Pay. You can pass these details while creating payment intent as mentioned in the code snippet below -

app.post("/create-payment", async (req, res) => {
  try {
    const paymentIntent = await hyper.paymentIntents.create({
      amount: 100,
      currency: "USD",
      billing_details: {
        address: {
          country: "US",
        },
      },
    });
    // Send publishable key and PaymentIntent details to client
    res.send({
      clientSecret: paymentIntent.client_secret,
    });
  } catch (err) {
    return res.status(400).send({
      error: {
        message: err.message,
      },
    });
  }
});

Integrate with Xcode

Add the Apple Pay capability to your app. In Xcode, open your project settings, click the Signing & Capabilities tab, and add the Apple Pay capability. You might be prompted to log in to your developer account at this point. Select the merchant ID you created earlier, and your app is ready to accept Apple Pay.

Log in to your , go to Identifiers and select the Merchant ID you created previously

Log in to your , go to Identifiers and select the Merchant ID you created previously

Log in to your , go to Identifiers and select the Merchant ID you created previously

Login to

💳
📱
Sign Up
Apple Developer account
add MerchantIDs section
Apple Developer account
Apple Developer account
Apple Developer account
PaySwitcher dashboard
Enable the Apple Pay capability in Xcode