Apple Pay Capabilities and How to Integrate It Using Stripe For Your Shopping App?

We’ve been talking about shopping apps a lot recently, but somehow we haven’t yet touched upon payment possibilities for this type of apps. In this article, we’re going to fix this. Grab your iPhone 6 or Apple Watch, and let’s uncover the integration particularities of Apple’s new payment system!  

How does Apple Pay work?

Apple Pay is very similar to PayPal, in that you can integrate it to your app to let your users pay for goods from within the app but the money will be debited from users’ linked accounts. What makes Apple Pay different from PayPal and other similar payment systems, is that it uses NFC technology to allow users to pay for products in physical stores equipped with NFC contactless card readers. You can see the list of stores that accept Apple Pay here.

The Apple’s payment system is compatible with all existing proximity readers, such as Visa PayWave, MasterCard Contactless, American Express, and ExpressPay, but unlike Samsung Pay, it doesn’t work at standard mobile payment terminals with magnetic stripe readers.

To start paying with Apple Pay, you need to add your credit cards through Wallet app. You neither need to enter a long number on your credit card, nor its expiry date: you can use your phone's camera to read this information automatically.

To make a transaction, everything you need to do is select Apple Pay in the list of payment options, choose a credit card, and hold your finger up to Touch ID to confirm the transaction. For the first-time payment you will also need to fill out some billing details (billing address, delivery address, phone number, and so on). Click here for detailed instructions. Apple charges 0,15 percent per transaction, and it cannot be used for in-app purchases for digital content.

Even though Apple Pay is supported by the latest generation of iPhones only, users of iPhone 5, 5C, 5S can still use Apple Pay if they have Apple Watch. In this case, they should double-click the side button to confirm a transaction.

"Pay with Apple Pay" functionality for a shopping cart

[Pay with Apple Pay for a fashion shoppping app designed by Yalantis. Check it out on Dribbble and read our article on fashion app development]

How does Apple Pay store credit card details?

Apple Pay doesn't. It assigns a unique Device Account Number for every device, and saves this number in the Secure Element chip on the iPhone, iPad and Apple Watch in the encrypted format. When processing transactions, Apple Pay doesn’t transmit the data on a bank card to the seller. Instead, it uses a so called “dynamic safety code.” This way nobody can reveal your credit card details using an Apple device. In case your phone is lost or stolen, you can use Find My iPhone program to switch off Apple Pay.

Since Apple Pay stores a secure transaction token on both iPhone and Apple Watch, you don't need data connection to use Apple Pay. This means that you can pay for goods without your phone provided you have Apple Watch and live in a country supported by Apple Pay. Right now the Apple’s payment system is available only in the USA and the UK. Australia and Canada are coming next. In 2016, the service will appear in Singapore, Spain, and Hong Kong.

As you can see, Apple’s payment system is spreading quite fast, so make sure you can reach Apple Pay users at the right time. Now let's dive into the technical details of Apple Pay integration!

See: Mobile app pricing

How can you integrate Apple Pay in your app?

Step 1: Create Apple ID

To accept Apple Pay payments, at first, you need to configure your app for working with Apple Pay. Go to Apple Pay developer documentation  Member Center, chose Certificates, Identifiers & Profiles\Identifiers\App IDs, and click “+” to create a new Apple ID. Enter the app's name and bundle, but make sure that Explicit App ID is chosen. Then, choose Apple Pay checkbox, click Continue and then, Submit to finish creating Apple ID.

Step 2: Create Merchant ID

After that, you should create a merchant ID. It’s very simple. All you need to do is click “+,” enter a name, and click Continue and Register.

Step 3: Set Up a Project

To set up your project, you need to open it in a needed target and change Bundle Identifier to an already created one. Then, move to the Capabilities tab, choose a section Apple Pay, and move a switch to “ON.” After that, you need to click on the checkbox that corresponds to the merchant ID you’ve created. Now, Apple Pay is ready for use!

Step 4: Implement “Pay with Apple Pay” button

The design of “Pay with Apple Pay” in-app button needs to adhere to Apple guidelines. You can download resources for creating the button on the official Apple Developer website.

Now let’s take a look at Apple Pay API.

Apple Pay API

To work with Apple Pay, you need to import PassKit framework that has needed classes for working with Apple Pay. When a user is about to make a purchase, you need to create PKPaymentRequest and PKPaymentAuthorizationViewController.

PKPaymentRequest is Apple Pay's object that corresponds to payment. PKPaymentAuthorizationViewController is an object needed for displaying a payment controller. It's created based on PKPaymentRequestLet’s take a look at the example:

let request = PKPaymentRequest()

let applePayController = PKPaymentAuthorizationViewController(paymentRequest: request)

self.presentViewController(applePayController, animated: true, completion: nil)

Then, you need to configure the PKPaymentRequest object:

  1. Define supported types of readers. There are three of them: PKPaymentNetworkVisa, PKPaymentNetworkMasterCard, PKPaymentNetworkAmex.
  2. Set up a current merchant ID
  3. Set up merchant capabilities
  4. Enter a county’s code consisting of two symbols
  5. Enter a country’s code for a current transaction.

For example:

request.merchantIdentifier = ApplePaySwagMerchantID

request.supportedNetworks = SupportedPaymentNetworks

request.merchantCapabilities = PKMerchantCapability.Capability3DS

request.countryCode = "US"

request.currencyCode = "USD"

These are the main settings for the client.

How to Handle Payment Requests

Now we need to set up PKPaymentAuthorizationViewControllerDelegate delegate for processing user actions in PKPaymentAuthorizationViewController. It has two required delegate methods:



The first method authorizes a user when a purchase is about to be made, while the second method is called when the payment is done. The implementation may look like this:

func paymentAuthorizationViewController(controller: PKPaymentAuthorizationViewController!, didAuthorizePayment payment: PKPayment!, completion: ((PKPaymentAuthorizationStatus) -> Void)!) {



func paymentAuthorizationViewControllerDidFinish(controller: PKPaymentAuthorizationViewController!) {

controller.dismissViewControllerAnimated(true, completion: nil)


How to Handle Shipping, Billing, and Contact Information?

Ask a user to provide goods delivery address:

switch (swag.swagType) {

case SwagType.Delivered:

request.requiredShippingAddressFields = PKAddressField.PostalAddress | PKAddressField.Phone

case SwagType.Electronic:

request.requiredShippingAddressFields = PKAddressField.Email


This code requires user to fill in the address where goods need to be delivered including name, city, street, state or province, postal code, and country, buyer’s phone number, and email.

Pay with Apple Pay animation

[User interaction with Apple Pay designed by Yalantis]

Adding Shipping Costs and Shipping Options

Here is how you can add a price for delivery (separately from the product’s price):

if (swag.swagType == .Delivered) {

summaryItems.append(PKPaymentSummaryItem(label: "Shipping", amount: swag.shippingPrice))


summaryItems.append(PKPaymentSummaryItem(label: "Razeware", amount:

request.paymentSummaryItems = summaryItems

You can also set up the following shipping methods in the app or ask a user to choose one of them:

  • Shipping the purchase to the provided address using a third-party shipping company (the default shipping type).
  • Delivering the purchase by the seller (for example, pizza, flower, or furniture delivery)
  • Store pickup of the purchase from the seller’s store.
  • Picking up an item from the provided address by the service (for example, transportation or shipping services that provide home pickup).

For each shipping method you need to specify: name, delivery price in the currency specified in the settings of purchase, description, and id.

Using Stripe for Payment Transactions

Apple Pay doesn’t fulfill any payment operations itself. It only authorizes transactions and creates tokens that allow for payment processing. To make a transaction, you need to use Stripe or any other service for implementing in-app payments. You can check out a list of them here. We chose Stripe, because it’s really easy to set up, and allows to make test payments inside the app.

After you created an account on Stripe, you need to generate a certificate using Certificate Signing Request (CSR) that Stripe offers. To do this you need to go the Apple Pay section and click Create New Certificate for downloading the .certSigningRequest file.

Then, you need to go to developer account in Member Center\Certificates, Identifiers & Profiles\Identifier\Merchant IDs, choose merchant ID and click Edit. Then, move to Create Certificate\Continue\Choose File, choose the certSigningRequest file that you got from Stripe and click Generate. After that, push Download for getting the .cer file.

Now you can download Stripe framework and continue implementing your payment functionality. Check out this tutorial for more information. Read also our article where we compare Stripe and Braintree, and stay tuned! We’re going to share more tips on implementing payment functionality in mobile apps.

3.7/ 5.0
Article rating
Remember those Facebook reactions? Well, we aren't Facebook but we love reactions too. They can give us valuable insights on how to improve what we're doing. Would you tell us how you feel about this article?
See what else we can do

Check out our knowledge and capabilities

Let's talk code

We use cookies to personalize our service and to improve your experience on the website and its subdomains. We also use this information for analytics.

More info