Paypal Payment Gateway Integration In Swift With SDK

Updated 27 February 2020

Save

Hi guys, today we will learn about how to implement Paypal Payment Gateway for an iOS application in Swift.

Let us know first what is the Payment gateway.

A payment gateway bridges the gap between customers, banks and online business. It safely and securely passes all the sensitive information such as customer’s credit card numbers and so on, from one end to the other. It is used for online transactions with the customer. It is a merchant service provided by an e-commerce application service provider that authorizes credit card or direct payments processing for e-businesses, online retailers, bricks and clicks, or traditional brick and mortar.

Now we can start the steps to integrate the payment gateway.

Step To Integrate Paypal Payment Gateway

Step 1 => Add ‘PayPal-iOS-SDK’ In The Project

To integrate PayPal into your Xcode project using CocoaPods, specify it in your Podfile:

and then run this command in the terminal

Step 2 => Setup of Paypal Environment

For testing purposes, you have to add these lines in your code it does not submit transactions to PayPal. It generates fakes successful responses that are useful for unit tests.

Step 3 => Implementation of Paypal Delegates

Then the third step is to implement the Paypal delegates. These delegates will call when payment is completed and when it is canceled.

Step 4 => Setup of Paypal

You have to set Paypal then you can initiate the payment. Add this code in your view controller and call this method for the setup of Paypal.

 

You can call this method by adding the following code.

 

Conclusion

So please follow the above step to integrate the Paypal payment gateway and if you have any issue or suggestion you can leave your query/suggestion in the comment section.

author
. . .

Leave a Comment

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


16 comments

  • Juan
    PayPal-iOS-SDK is deprecated ?
    • Vicky Kumar (Moderator)
      Yes, it is now deprecated.
      • saif
        hi i want to integrate for UAE in IOS but could not create production account as sdk is depericated
        • Vicky Kumar
          Please use Braintree as the PayPal SDK is now deprecated https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
      • Shivaganeshgupta
        Hi Vicky Kumar,
        Shall we use PayPal SDK for iOS
        • Vicky Kumar
          Please use Braintree as the PayPal SDK is now deprecated https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
      • Rakesh Mandloi
        so how we can integrate PayPal now? is there any alternative.
        • Vicky Kumar
          Please use Braintree as the PayPal SDK is now deprecated https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
    • Niraj Ajudiya
      How to integrate paypal now? Any ideas can you suggest
      • Vicky Kumar (Moderator)
        You can use Braintree for PayPal payment gateway integration.
        • Aravindh
          is there any option to integrate Paypal without Braintree?
          • Vicky Kumar
            The PayPal SDK is now deprecated, and if you wish to integrate it using SDK then you have to use Braintree https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
        • brajpal
          Cannot find type ‘PaymentMode’ in scope
          • Vicky Kumar
            Please use Braintree as the PayPal SDK is now deprecated https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
  • Aravindh Jahan
    can you please help to integrate paypal payment gateway without Braintree
    • Vicky Kumar (Moderator)
      The PayPal SDK is now deprecated, and if you wish to integrate it using SDK then you have to use Braintree https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
  • Start a Project


      Message Sent!

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

      Back to Home