How to Integrate Apple Pay into iOS App?

By Saurabh Barot   |   7 June, 2022
How to Integrate Apple Pay into iOS App?

Quick Summary:

Apple Pay is the most secure payment wallet and service provider for iOS apps. You should integrate Apple Pay into the iOS app if you are planning to set up an eCommerce app or need to include in-app purchases in your mobile app. Here is the ultimate detailed Apple Pay Integration iOS guide for you to set it up to provide your customers with a seamless and secure payment experience.

iOS is one of the best mobile app platforms, especially if banking on in-app purchases to drive your business revenues and profits. How? IOS has a tiny percentage of the overall market share compared to Android. However, it manages to provide higher revenues via app purchases and other app monetization methods. IOS covers only 13 per cent of the overall market share, yet most of its users belong to countries such as the US, UK, Canada and Japan. Citizens of such countries have higher minimum wages and better average salaries, and hence they don’t mind spending a couple of dollars on in-app purchases and even on ecommerce apps if it delivers on their expectations. Hence, the spending characteristic of Apple customers makes it a profitable platform to build your mobile app on.

Importance of Securing payment gateway in iOS App

Your app needs to meet certain design and performance benchmarks and have the right security measures in place if it will deal with financial transactions and sensitive user data. IOS is way stricter about the types and quality of apps it allows to be uploaded to the Apple App Store compared to Android. It is important to integrate a secure payment gateway in your iOS app to ensure the client’s safety and your app’s approval on the Apple app store. And what can be more secure and in accordance with Apple’s guidelines than Apple’s own Apple Pay payment wallet and services platform?

Why Integrate Apple Pay in iOS App?

Apple Pay is a digital wallet and mobile payment service introduced by Apple Inc. to provide a secure, reliable and straightforward method to make payments in iOS, watchOS, iPadOS and web apps on Safari. There are many benefits Apple Pay brings to the merchants managing their online web app on the iOS platform. Using Apple Pay can increase your customer conversions, increase new user adoption and provide many more benefits to your business.

Why to Integrate Apple Pay in iOS App

Apple Pay Key Features

Here are the key features that make integrating Apple Pay in your iOS app a good idea:

Features of Apple Pay

Apple Pay Feature Description

Using Apple Pay as the default payment option, merchants can reduce the chances of cart abandonment, and minimize customer frustration, ultimately resulting in higher conversions.

Secure Data

Apple Pay is highly secure, especially compared to traditional debit and credit cards. All transactions via Apple Pay need FaceID, TouchID or the users’ passcode. Moreover, with Apple Pay, you won’t get customers’ actual card details. Hence there’s no need or risk of handling customers’ sensitive banking details.

Express Checkout

With Apple Pay, customers can complete a purchase directly from the product page with one tap, without filling out a form.

Inline Setup

Apple Pay supports an inline setup, allowing users who haven’t provided any card details in their Apple Pay account.

Apple Pay Adoption Stats and Facts

Online shopping is the new normal shopping experience, and while desktop ecommerce websites continue to have a majority share of that traffic, m-commerce is taking the lead in contributing to online shopping. As per a study conducted on Statista, 72.9 percent of all retail ecommerce was forecasted to be generated via m-commerce.

It makes the overall shopping experience more accessible, quick and flexible. The ease of paying through mobile phones is changing customer spending habits and the frequency of their purchases.

Hence, optimizing payment processes in your iOS app is more important than ever. And how to provide the best checkout and payment experience to your iOS users? Enter Apple Pay.

Also Read: iOS App Development Best Practices

Apple Pay Popularity Facts and Stats 2022

  • As per a BusinessofApps Report, Apple Pay ranks third in the number of mobile payment users by app with 507 users.
  • As per a study conducted by Statista, 56% of all respondents (1383) used Apple Pay for paying at different places such as restaurants and other places using their iPhone in the past 12 months.
  • Apple Pay can be used in 73 countries worldwide, whereas Google Pay is only supported in 42 countries.

Planning to Hire iOS Developers?

Our skilled team of iOS developers at Aglowid can develop scalable & feature-rich iOS apps for your business niche

How to Integrate Apple Pay in iOS App?

There are many benefits and reasons to provide Apple Pay as a payment service in your iOS app. Apple has very crisp and clear documentation stating how to integrate Apple Pay into iOS app. However, we will run it through you briefly for your understanding:

How to Integrate Apple Pay in iOS App

1. Start by creating an Apple ID and Merchant Identifier

To enable Apple Pay in your iOS app, you need to register a unique identifier with Apple that distinguishes and identifies your firm as a merchant that can accept payments. Visit the website and log in to your Apple developer account. Next, visit the Certificates>Identifiers>Profiles tab.

Select the Apple ID under Identifiers and tick the Apple Pay box below Apple Services. Click the continue button, and you will have your newly created Apple ID. Next, select the Merchant ID button on the top right corner and click on the (+). Fill in the details asked in the Merchant ID form and make a bundle ID that starts with the word ‘Merchant’. You now have an Apple ID and Merchant Identifier.

2. Configure Apple Pay in Xcode

The next step to integrating Apple Pay into your iOS app will be to configure your Apple Pay services in Xcode. Go to. Project section on the Xcode, and click Capabilities. After you turn on the Apple Pay toggle and add your Merchant ID, refresh your page, and the Merchant ID will be visible on the developer portal. Ensure that Teambox indicates the right time and ensure all the checkboxes under Steps are ticked.

3. Create a Sandbox user in iTunes Connect and Add a new Test Card

You are almost halfway through the Apple Pay iOS app integration process. After completing the two steps mentioned above, create a new Gmail account. Head over to and select Users and Roles. Here click on Sandbox Testers and click the (+) icon. From the list of countries, choose a country where Apple Pay is available, for instance, the United States. Doing so will generate a new Gmail ID formed via your Apple ID. Next, log out of your iCloud account and log in using the Sandbox credentials.

Now add a new test card for Apple Pay like:

  • FPAN (Funding Primary Account Number): 1234 5678 8765 4321
  • Expiration Date: 12/28
  • CVC: – 012

4. Make Payment Request in your iOS App

Next, you need to create a payment request for your project. You can use any button from the storyboard to the ViewController. After this, connect IBAction with your ViewController.swift. Insert the following lines to the ViewController:

Import PassKit

Next, configure your payment request in purchaseItem():

@IBAction func purchaseItem(_ sender: Any) {

let request = PKPaymentRequest()

request.merchantIdentifier = ""

request.supportedNetworks = [, PKPaymentNetwork.masterCard,]

request.merchantCapabilities = PKMerchantCapability.capability3DS

request.countryCode = "US"

request.currencyCode = "USD"

request.paymentSummaryItems = [

PKPaymentSummaryItem(label: "Some Product", amount: 9.99)


let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request)

self.present(applePayController!, animated: true, completion: nil)


Now run the app and check if your Buy with Apple Pay button works.

Also Read: iOS App Performance Optimization

5. Manage the Output

Add the following code to purchaseItem():

applePayController?.delegate = self

Next, add the following extension:

extension PaymentViewController:


func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) {

controller.dismiss(animated: true, completion: nil)


func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) {

completion(PKPaymentAuthorizationResult(status: PKPaymentAuthorizationStatus.success, errors: []))



You should now check if your Apple Pay integration in the iOS app is working properly by making a minimal amount payment and making a payment request with your selected payment method. Now to complete this payment add the following code in the didAuthorizePayment method:

completion(PKPaymentAuthorizationResult(status: PKPaymentAuthorizationStatus.success, errors: []))

Benefits of Apple Pay Integration iOS

You can see that you can integrate apple pay in the iOS app very easily. There are many reasons to adopt Apple Pay for powering and managing the payments and ecommerce of your iOS apps. Here we have listed the benefits of using Apple Pay from consumer and merchant perspectives both.

“Build your iOS App Market-Ready with Greater Performance”

Connect with US and Get Best-in-Class

Apple Pay Integration iOS Benefits to Merchants

As a service provider, it is of utmost importance to develop an app that helps run your business smoothly and generates revenues and easy access to customers to be an asset and not an unnecessary spend. You need to make sure your customers are willing to use the mobile app and get exclusive benefits and security to want to purchase more from your business.

Apple Pay Integration iOS Benefits to Merchants

Quicker and Steadier Cash Flow

Apple Pay is faster than most traditional payment methods in transferring the collected funds from the consumer to the merchant’s account. This helps the merchant keep a positive cash-flow which helps the business stay ahead of their expenses.

Reaching New Customers

Apple Pay has a huge user database with more than 30.3 million users from the US alone. When a merchant adds Apple Pay as a payment option to their app, they can target this vast pool of mobile-preferred consumers. Moreover, if a merchant fails to implement such a huge opportunity, they risk losing a significant share of potential customers.

Attract the younger audience

Millennials and Gen-Z together make up the young adult or late teen population of the world. This generation prefers a mobile-first experience and is comfortable making payments via mobile in place of cash or physical debit/credit cards. Providing such potential users with a chance to personalize their payment journey while providing the flexibility of payment options will encourage them to spend more time on your app and make more purchases.

Benefit for SMEs

Apple Pay uses its tap-to-pay terminal technology via the built-in NFC chip in iPhones and other Apple devices. With this, merchants will be able to accept payment via Apple Pay or any other debit card and credit card without any external hardware. If you own an iPhone and run a small business or store, you won’t need to buy a POS machine or other third-party hardware to accept payments.

Also Read: Top Swift Design Patterns for iOS App

Apple Pay Integration iOS Benefits to Consumers

Apple Pay is beneficial for the merchant and has many benefits for iOS users. Although all the help they get ultimately makes them spend more time on your app and make more purchases from you, it’s an indirect benefit to the merchant. Here are some of the benefits of Apple Pay to consumers:

Apple Pay Integration iOS Benefits to Consumers

Single Tap Payments

Apple Pay is fast and without hassle. You don’t have to enter card details or personal data manually; it stays securely stored with Apple Pay System. Hence users can approve transactions with a single click, reducing cart abandonment chances and improving the customer experience while shopping online.

Improved Security

Issues like data breaches, credit card fraud and identity theft are on the rise, raising major security concerns for customers. Apple keeps simplicity and security at its core for any product they design, and the same is true for this service called Apple Pay. Apple Pay has been designed with a privacy-first approach and has the right measures to safeguard user transaction details and financial information. Apple Pay utilizes various advanced authentication methods such as face identification, fingerprint readers, biometrics, and more to strengthen the authentication process.

Moreover, though Apple stores the customers’ card details and bank account information, it never sends this data to the merchant. Since this data is never in transit, the chances of being breached or exploited reduce significantly. Also, the customer only shares their personal information with Apple and not all the merchants they purchase with.

Convenience and Reliability

It isn’t unnatural or uncommon for people to forget their wallets at home when they leave for work or travel. But ignoring your smartphone is comparatively less unlikely. Apple Pay can be used as a physical card or via the app, using the NFC chip in Apple devices. Hence, customers can easily go wallet-free yet have a reliable payment tool for their iPhones, iPad and other Apple products.

have a unique app Idea?

Hire Certified Developers To Build Robust Feature, Rich App And Websites.

Wrapping up!

This is your ultimate tutorial on integrating Apple Pay into your iOS app. Apple Pay is slowly climbing the stairs to becoming one of the most accepted and trusted payment services globally. If you want to stay relevant and secure your online commerce business against various malicious attacks and threats, integrate Apple Pay into your iOS app today by following this easy-to-follow guide.

Get in Touch!

Saurabh Barot

Saurabh Barot is co-founder and Experienced Chief Technology Officer at Aglowid IT Solutions. His deep industry experience in Angular, React, Ruby on Rails, PHP, Mean Stack and just to name few, has helped the company reach to a new level. He believes that technology is all about exploring new possibilities. Whatever a mind can think (exception can't be ruled out), technology brings it into reality.

Related Posts