Integration

You can integrate with the CheckoutPro mobile SDK in 5 steps:

1.Include the SDK in your app project (Mandatory Step)

The CheckoutPro SDK is offered via CocoaPods. To add the SDK to your app project, include the SDK framework in your podfile.

// make sure to add below-mentioned line to use dynamic frameworks
use_frameworks!

// Add this to include our SDK
pod 'PayUIndia-CheckoutPro' 

Install dependency using pod installcommand in terminal

Next, add the following imports in the class where you need to initiate a payment

Test Merchant key/salt for production environment : 3TnMpV/g0nGFe03

Test Merchant key/salt for test environment : gtKFFx/eCwWELxi

Swift Package Manager Integration

You can integrate PayUIndia-Checkoutpro with your app or SDK in two ways:

  1. Via Xcode - Go to File-> Add Package-> https://github.com/payu-intrepos/PayUCheckoutPro-iOS

  2. Via Package.Swift - Add below line in Package.swift dependencies

.package(name: "PayUCheckoutProKit", url: "https://github.com/payu-intrepos/PayUCheckoutPro-iOS", from: "4.0.0")

CrashReporter

In order to receive all the crashes related to our SDKs, add the below-mentioned line your AppDelegate's didFinishLaunchingWithOptions.

2. Set up the payment hashes (Mandatory Step)

Detailed document is present here.

3. Build the payment parameters (Mandatory Step)

To initiate a payment, your app will need to send transactional information to the Checkout Pro SDK. To pass this information, build a payment parameter object as

For Recurring Payments(SI)

If you are integrating SI, then create an object of SIParam as mentioned here.

After creating an object, pass the object as below:

Payment parameter definition

Parameter

Type

Description

Data Type & Validation

Mandatory

Key

String

Merchant key received from PayU

Can not be null or empty

Yes

Transaction ID

String

It should be unique for each transaction

Can not be null or empty and should be unique for each transaction. It can not contain special characters like :-_/

Yes

Amount

String

Total transaction amount

Can not be null or empty and should be valid double stringified eg, “100.0”

Yes

Product info

String

Information about product

Can not be null or empty and should be less than 100 Characters.

Yes

First Name

String

Customer’s first name

Can not be null or empty

Yes

Email

String

Customer’s email id

Can not be null or empty

Yes

Phone

String

Customer’s phone number

Should be a valid phone number

Yes

SURL

String

When the transaction is successful, PayU will load this url and pass transaction response

Should be a valid URL

Yes

FURL

String

When the transaction is a failure, PayU will load this url and pass transaction response

Should be a valid URL

Yes

Environment

Environment

Environment of SDK

Should be either Swift: Environment.production or Environment.test

ObjectiveC: EnvironmentProduction or EnvironmentTest

Yes

User Credential

String

This is used for the store card feature. PayU will store cards corresponding to passed user credentials and similarly, user credentials will be used to access previously saved cards

Should be a unique value

Format : <merchantKey>:<userId>

Here,

UserId is any id/email/phone number to uniquely identify the user

No

PayUSIParams

Object of PayUSIParams

Details can be found here

Object of PayUSIParams

No

Additional Params:

Additional params are optional params that can be passed to SDK like udf params, static hashes. More details on static hash generation and passing is mentioned in hash generation section. Below is list of params that can be passed in additional params -

Parameter

Type

Description

Mandatory

PaymentParamConstant.udf1

String

User defined field, Merchant can store their customer id, etc.

No

PaymentParamConstant.udf2

String

User defined field, Merchant can store their customer id, etc.

No

PaymentParamConstant.udf3

String

User defined field, Merchant can store their customer id, etc.

No

PaymentParamConstant.udf4

String

User defined field, Merchant can store their customer id, etc.

No

PaymentParamConstant.udf5

String

User defined field, Merchant can store their customer id, etc.

No

Static Hashes

String

Covered in the Hash Generation section

No

PaymentParamConstant.sourceId

String

Source id of sodexo saved card

No

4. Initiate the payment (Mandatory Step)

Initialise and launch the Checkout Pro SDK by calling the following method from your UIViewController’s subclass

5.Handle the payment completion (Mandatory Step)

Confirm to PayUCheckoutProDelegate and use these functions to get appropriate callbacks from the SDK:

For UPI Intent (Optional Step)

Currently we support only PhonePe and GooglePay via Intent. Add the query schemes in info.plist

Distributing your app (App Store / Ad-hoc) (Mandatory Step)

What you get by default is a fat framework that allows you to test your app seamlessly on device as well as simulator. But before archiving your app, you need to remove simulator slices from the framework. Please see the doc which assists in archiving your app with PayUChekoutPro integrated.

Last updated

Was this helpful?