Apple Pay provides an easy and secure way to pay in your iOS apps, watchOS apps, and websites on Safari. By using Face ID, Touch ID or double-clicking Apple Watch, users can quickly and securely provide their payment, shipping, and contact information to check out. Customers love the simplicity of Apple Pay, and you’ll love the increased conversion rates and new user adoption that come with it

Why Apple Pay ?

Customers prefer using Apple Pay as they can make purchases without having to enter their billing, shipping, and contact details.

Customers and developers like the peace of mind that comes with the increased security and privacy of Apple Pay.

Apple does not store or share a customer’s actual credit and debit card numbers, reducing the risk for merchants and app developers to manage and secure actual credit and debit card numbers.

Apple Pay Supported Devices

The first and foremost feature needed for Apple Pay in iOS devices is Touch ID. All iPhones having Touch ID(iPhone 6,iPhone 6s, iPhone 6 Plus and released after) and iPads supports Apple Pay except iPhone 5s due to security concerns.

Apple Pay setup

Create AppID:

Head over to and log in to your developer account.

  • Go to Member Center and click on Certificates, Identifiers & Profiles\Identifiers\App IDs.
  • Click on the + button to create a new App ID, name it and give it a Bundle ID of the format com.DOMAINAME.AppName.
  • Make sure that Explicit App ID is selected, as wildcard App IDs aren’t able to make payments with Apple Pay.
  • Finally, check the Apple Pay checkbox under App Services, click Continue and then click Submit to complete the creation of your new App ID.

Create Merchant ID and add it to App ID:

  • Once the App Id is created, click on Merchant IDs under Identifiers in the left navigation pane of developer account.
  • Click + to create a new merchant ID, use whatever description and merchant identifier you’d like. Generally, it’s recommended to create merchant identifiers in the reverse domain style that start with merchant, similar to bundle IDs.
  • Click Continue and then click Register to create your new merchant ID.

Setting Up an Xcode project

  • Select the created project in the left navigation bar, then select the project target and change the Bundle Identifier to match the one you created above.
  • Ensure that the Team selection box is pointing to the development team under which you created your App ID and merchant ID.
  • Click the Capabilities tab. Expand the Apple Pay section and ensure that the switch on the right is set to ON. Then push the refresh button below the merchant ID list, you should see the list populate with the merchant ID you added on the developer portal, if it wasn’t there already.
  • Finally, check the checkbox next to your merchant ID.

Create Sandbox testing account for testing payment through Apple Pay

To create a sandbox tester account, follow these steps:

  • Sign in to iTunes Connect.
  • On the homepage, click Users and Roles (If the option is not seen, Please contact your administrator to provide the required access).
  • Click Sandbox Testers. Select “+” to set up your tester accounts.
  • Complete the Tester Information form and click Save (Please use an email Id which is not associated with Apple yet. The sandbox testing account creates a new Apple account with the filled information).
  • Sign out of your Apple ID on all testing devices and sign back in with your new sandbox tester account.

Configure your device to support Apple Pay

To support Apple Pay in your device, your device must fulfill all the basic requirements which includes Touch ID, Apple Pay supported regions and supported payment networks. If your device satisfies with all such requirements, you can add a sandbox testing payment cards in your device. You can all the sandbox testing cards from the link:

You can find all the payment cards for testing for all the major payment networks like Visa, MasterCard, Discover and American Express. Add any of the cards to your device simply by following steps below:

  • Go to Settings.
  • Wallet & Apple Pay(only visible if your region is set to one of Apple Pay supported regions).
  • Click on Add Credit or Debit Card > Next.
  • Enter Card details Manually.
  • Fill all the necessary card details including card name and card number.
  • Click Next and wait for sometime and enter some more information related to card.
  • Click Next and your card will be added to your device.

Stripe Setup

Apple Pay, of course, doesn’t fulfill payment transactions, it only authorizes transactions and creates tokens that allow payments to be processed. To process transactions there are some payment processors available which decrypts the Payment token information encrypted by Apple after successful authentication of Touch ID during payment with Apple pay

Stripe  is one of the easiest to use the online payment processor. One of the nice things about Stripe, besides being easy to set up, is that it comes with a built-in test payment environment so you can easily test purchases in your app without incurring real charges.

Now that you have setup the Apple pay required things, you’ll want to request that these charges be fulfilled. Apple Pay, of course, doesn’t fulfill payment transactions. It only only authorizes transactions and creates tokens that allow payments to be processed.

Account Creation and Configuration:

Sign up for a free Stripe account at

The first things you’ll need to do after creating your Stripe account is to tell Stripe about your app and generate a certificate using a Certificate Signing Request, or CSR provided by Stripe.

Head to the Apple Pay section of your Stripe account at Press Create New Certificate to download a .certSigningRequest file

Now go to your developer portal and navigate to Member Center\Certificates, Identifiers & Profiles\Identifier\Merchant IDs.

  • Select your app’s merchant ID and click Edit.
  • Navigate to Create Certificate\Continue\Choose File, select the .certSigningRequest you downloaded from Stripe and then click Generate. Click Download to receive your .cer file.
  • Go back to Stripe, in the Apple Pay section where you created the CSR and upload your new certificate file. Click on the API Keys section of your account, record the Test Secret Key and Test Publishable Key for use later in your app. These test keys will let you to make “fake” payments from Apple Pay.
  • You’re all set to send payment requests with your merchant ID to Stripe to be decrypted and processed.

Apple Pay flow using Stripe

As you have setup the required things for Apple pay integration, it is time to do some coding!. Apple provides the required methods to display the Apple pay button and the payment summary view. It is provided as part of Passkit framework, make sure the Passkit framework is imported in your file.

Explore the various styles provided by the framework for the apple pay button. Implement the function ‘payByApplePay’ on tapping the apple pay button. Here we go,

In the above snippet we are creating PKPaymentRequest to process the payment transaction on tapping the apple pay button.

Creating PKPaymentRequest includes the following,

  • Assign the merchant Identifier we created for our app to the payment request.
  • Set the currency and country codes (Here in the example we are using ‘US’ and ‘USD’).
  • Configure the support payment networks that your app can support and set it to the request.
  • Configure the shipping methods and the shipping fee as per your requirements.
  • Finally, present the ‘PKPaymentAuthorizationViewController’ with the paymentRequest you have created.

We have successfully implemented the Apple Pay  feature initial part. We will see the server implementation to handle Apple pay request in Part 2.