logo
logo
Sign in

Integration Of ApplePay With Your iOS App: Step By Step Guidance

avatar
Concetto Labs
Integration Of ApplePay With Your iOS App: Step By Step Guidance


The best form of payment in an iOS app is possibly Apple Pay - easy and efficient for both the developer and the user. Using ApplePay now users can quickly make transactions and app should support the services.


Now, we will have a look at a step by step guide on how to integrate ApplePay with the iOS app



First of all, you need to do is download the starter project in the ViewController.swift file, here the shoe struct for the same is also available:

To populate our picker view we will use this along with the array of Shoes and retrieve the price later.

The second thing required to start with ApplePay is to create a merchant ID in the developer portal. The benefit is that it will allow Apple to identify your app as a ‘merchant’ for purchases.

For creating merchant id, first we need a unique bundle identifier for an app and in the app, settings go to identity and the user can put a self bundle identifier - only if a user is making their own app like for example - (com.username.app-name.)
The second step is to jump into the development member center and from the menu select ‘’Identifiers, Profiles and Certificates.’’

From the left menu select ‘Merchant IDs’ tap ‘+(plus)’ on the top right corner. The description window gets open, all you need to do is enter the app name than in the identifier type ‘merchant.’ Add your bundle identifier. Tap Continue and then Register.

After this, we need CSR - Certificate Signing Request and for these open up keychain access, from the top menu select ‘Certificate Assistance’ in that ‘Request a Certificate from a Certificate Authority.’

In the ‘User Email Address’ field add an email address, select the ‘save to disk’ option for your request.

We need to create a payment processing certificate that will be used for securing transaction data. Go to the member center and select ‘’ All Certificates’’ from the side menu. Click on the ‘+’ button on the top right corner and create a new certificate. 

Under ‘’Production’’, you need to select the ‘Apple Pay Payment Processing Certificate.’ select the earlier created ‘Merchant ID’ than under the apple pay payment processing certificate tap on to ‘Create Certificate.’

As you click Apple will ask ‘Will payments associated with this Merchant ID be processed exclusively in China?’ go with Yes and continue through the process and upload your CSR that is saved earlier from Keychain access.

Yay! Certificated created successfully. Download and save it with your project and double click on it and it gets processed in Keychain Access. 

Now, back to Xcode and enable Apple Pay there and under ‘Capabilities’ turn on Apple Pay and select the correct Merchant ID.
First of all, you need to do is download the starter project in the ViewController.swift file, here the shoe struct for the same is also available:

To populate our picker view we will use this along with the array of Shoes and retrieve the price later.

The second thing required to start with ApplePay is to create a merchant ID in the developer portal. The benefit is that it will allow Apple to identify your app as a ‘merchant’ for purchases.

For creating merchant id, first we need a unique bundle identifier for an app and in the app, settings go to identity and the user can put a self bundle identifier - only if a user is making their own app like for example - (com.username.app-name.)
The second step is to jump into the development member center and from the menu select ‘’Identifiers, Profiles and Certificates.’’

From the left menu select ‘Merchant IDs’ tap ‘+(plus)’ on the top right corner. The description window gets open, all you need to do is enter the app name than in the identifier type ‘merchant.’ Add your bundle identifier. Tap Continue and then Register.

After this, we need CSR - Certificate Signing Request and for these open up keychain access, from the top menu select ‘Certificate Assistance’ in that ‘Request a Certificate from a Certificate Authority.’

In the ‘User Email Address’ field add an email address, select the ‘save to disk’ option for your request.


ApplePay



We need to create a payment processing certificate that will be used for securing transaction data. Go to the member center and select ‘’ All Certificates’’ from the side menu. Click on the ‘+’ button on the top right corner and create a new certificate. 

Under ‘’Production’’, you need to select the ‘Apple Pay Payment Processing Certificate.’ select the earlier created ‘Merchant ID’ than under the apple pay payment processing certificate tap on to ‘Create Certificate.’

As you click Apple will ask ‘Will payments associated with this Merchant ID be processed exclusively in China?’ go with Yes and continue through the process and upload your CSR that is saved earlier from Keychain access.

Yay! Certificated created successfully. Download and save it with your project and double click on it and it gets processed in Keychain Access. 

Now, back to Xcode and enable Apple Pay there and under ‘Capabilities’ turn on Apple Pay and select the correct Merchant ID.

Let’s Start Coding:

Open file ViewController.swift and add the following function inside the class.

This will be used to display information to the user as they go through the ApplePay process.

 
Next, you need to do is to connect IBAction with your ViewController.swift. And for using Apple Pay effectively just insert the following line into ViewController:

Import PassKit

Now, Configure the payment request in purchaseItem():
 
 
 
Now, Deal with the output and add the following line to purchaseItem(): that makes the
 
 
described extension.
 
 
 
Time to test…!!!
 
All you need to do is make a successful payment by continuing with the payment request by selecting a payment method such as Visa, Stripe, MasterCard, etc.

To complete the payment just insert following line in the didAuthorizePayment method:
 
 
Wrap Up:
 
hire iOS app developer
 
It’s done this is how you can integrate ApplePay with your iOS app. Or still, you have any doud or problem then we also provide the facility to hire iOS developers integrate Apple Pay. Not just this, you can also hire iOS app developer at Concetto Labs to build your dream application that helps to grow your business.
 
collect
0
avatar
Concetto Labs
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more