Implement Apple pay in swift 5

Save

During the presentation on the 9th of September 2014, Apple introduced Apple Pay — its own system of mobile payments.

Apple pay allows iPhone 6 and iPhone 6+ users, as well as those who have new versions of Apple Watch easily shop online now, and benefit from apple pay app integration as well as make payments with the help of NFC (Near Field Communication) Technology. Touch ID or Face ID technologies are used for payment authorization.

How to Set Up Apple Pay in The App

To set up your environment to implement Apple Pay in your apps, you must complete these steps:

  1. Create a Merchant ID
  2. Configure Apple Pay capabilities in Xcode for your project
  3. Create a sandbox user in iTunes Connect
  4. Add a test card
  5. Create a payment request in your project
  6. Handle the result

Step 1: Create a Merchant ID from your Apple Developer Account.

Steps 2: Configure Apple Pay capabilities in Xcode for your project

Steps 3: Create a sandbox user in iTunes Connect

Login this sandbox account in the device or simulator.

Steps 4: Add a test card in the account

Please click here for demo card details.

Steps 5:  Create a payment request for the project.
First, create UI For apple pay.

Import the PassKit Library in ViewController

Create a Payment Request in the ViewController

Handle the Apple Pay button action and make payment request

Steps 6: Handle the result

Confirm the PKPaymentAuthorizationViewControllerDelegate in the View Controller

Now run your app.

In this way, you can integrate Apple pay in your app. I hope you understand the whole process. If you have any queries or suggestions please comment below.

Thank you

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


16 comments

  • Anand
    Hello Sir/ma’am

    i am ios developer and integrate apple pay in my application and i have follw this step.but how i can test app in india? is it possible to test app in an indian appstore account?

  • aksa
    sir can you plx tell me how can i put the condition in this, if the payment is done go to home view controller else do something?
    • Debabrata Roy (Moderator)
      After payment is done paymentAuthorizationViewControllerDidFinish method will be called, so you can put your condition inside this method.
  • Ankit Kumar Gupta
    how would I know that the payment is successful or failed?Please do let me know?
  • Ankit
    If we send -> completion(PKPaymentAuthorizationResult(status: .success, errors: nil)) , then the payment gets charged
    • Debabrata Roy (Moderator)
      You have to implement any third party payment gateway like stripe, which collect payment from Applypay and return your success and failure status.According to this result, you have to manage the completion
  • HM
    Hi,
    This is wonderful tutorial on google.
    i want to know
    1. how to test apple pay using live stripe key, in india.
    2. how to test apple pay using live app india.
  • Rafat
    Dear
    Just I am confused how to integrate this Ui pay view controller with my main app
    If the customer pay the app will automatically installed and show him my main app storyboard view controller
    Please send me your details
    Thanks
    • Debabrata Roy (Moderator)
      Call PKPaymentAuthorizationViewController from any event live button click and Applypay SDK will handle the payments screen.
  • Deepak
    Where is See all payment Transition live apps.
  • Adarsha
    How to integrate add to apple wallet feature in app
  • SureshKannan
    In my app error message “check the settings for this app and make sure it was designed to use apple pay.”
    • jitendra kumar (Moderator)
      Hello,
      Kindly contact us at [email protected]. So that we could assist you in a better way.
      Thanks
  • css.php

    Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.

    Stathis Plakidas

    Stathis Plakidas

    Talk to Sales

    Global

    Live Chat
    Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home