Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Hi guys, today we will learn about how to implement PayU Money Payment Gateway for an iOS application in Swift.
Before starting to code first we need to know what a payment gateway is
A payment gateway is an e-commerce system that helps support modern retail or other types of sales of products and services, over the Internet or at brick-and-mortar stores. Payment gateways authorize credit card payments in order to support point-of-sale systems.
Thus, it’s enough for us now. Let’s start by following the instructions below.
We can add it by following ways:
a.) By Integrate Payu Money SDK using Cocoa Pods:
To integrate Payu Money into your Xcode project using CocoaPods, specify it as a target in your Podfile:
(i) Add the following lines to Podfile of your project:
(ii) Then, run the following command to install it:
b.) Manually include Payu Money framework in your project :
For manually include the Payu Money framework, you have to follow the given below steps:
(i) Add Payu Money SDK to your project from Github
(ii) Clone or download the framework from the Github.
(iii) Unzip the “PayUMoney-IOS-SDK-master.zip” file and open it.
(iv) Navigate to the “PlugNPlay” folder & drag the PlugNPlay.framework into your project
(v) In Xcode, add the PlugNPlay.framework in Link Binary With Libraries & Embedded Frameworks section.
After installation, you must import the SDK in your project by adding the following line to the files in which you want to use this framework.
To start using the PayUmoney PnP SDK, you need you to initialize the SDK by providing details about the customer and the transaction. To initiate the payment, create an object of type ‘PUMTxnParam’ and set all the mandatory parameters as shown below:
You can handle success or error events when a payment is completed by “PlugNPlay.presentPaymentViewController“.
The only server-side change required while integrating the PayU Money SDK is to generate a hash parameter for both the payment request & response.
A hash is an encrypted value (checksum) that is to be sent by the merchant in a payment request and sent by PayU Money in the payment response. A hash is used to protect transactions against “man in the middle attack”.
The SHA512 hash implements the HashFunction protocol for the specific case of SHA-2 hashing with a 512-bit digest (SHA512Digest). Larger digests take more space but are more secure.
Note: The entire hash logic is built on the assumption ‘Salt’ is always safe with the merchant. Hence is very important for the merchant to keep the ‘Salt’ safe by adhering to the best security practices. For eg: Merchant should always compute from the server-side and never from the client-side, should never share the ‘Salt & Key’ over emails or directly commit to public repositories like Github.
So please follow the above step and if you have any issue or suggestion you can leave your query/suggestion in the comment section I will try to solve that.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.