Custom Browser- iOS – PayU Documentation

Custom Browser iOS


  1. A mobile app to accept payments

Steps Involved


On a broader level, you need to complete the following steps to integrate Custom Browser:

  1. Download the iOS Custom Browser v5.1 from the link here.
  2. Unzip the downloaded kit , drag and drop libiOSCustomBrowser.a and iOSCustomBrowser folder out of it.
  3. Add libz.tbd libraries into your project.
  4. Add -ObjC in Other Linker Flags in Project Build Settings.
  5. To open the custom browser, you need to use PUCBWebVC (This view controller creates a UIWebView , then loads it to facilitate payment and it is responsible to manage custom browser).

Once you have downloaded the iOS Custom Browser v5.1 file from the Github link, add the .a file and PayU folder into your project.

Adding the .a file and PayU folder into your project.


Adding libz.tbd libraries:


Adding -ObjC in other linker flags in build settings:


Using PUCBWebVC to create web view

There are two designated initializers of PUCBWebVC:

1. You can pass a NSURL request to the initializer at the time of initialization by calling the following:

2. You can pass post params string, a URL and merchant key using designated initializer method as follows:

After calling any of the above two methods, you must check the error object. It should contain error info if for some reason view controller was not created. If error is nil here, your view controller is ready. You just need to push/present it to start your payment flow.


With this being done, you have completed the integration of iOS Custom Browser v5.1 in your app. Additionally, we offer some customizations to provide you a better handle over the Custom Browser. In order to do the customizations, you should do it after creating the instance of PUCBWebVC view controller and before pushing/ presenting it.

In order to use these configurations you need to make an instance of PUCBConfiguration and call it’s delegate method. This is a singleton class

The configurations available are as follows:


Configuration Description Implications: Enabled Implications: Disabled Default values
isMagicRetry This configuration prevents all the transactions getting dropped due to bank pages not loading up due to network drops. It stores the last URL of the transaction and allows the customer to continue the transaction from where he left it. Allows magic_retry

customBrowscbConfig.isMagicRetry = YES;

Disallows magic_retry

customBrowscbConfig.isMagicRetry = NO;;

shouldShowPayULoader You can choose to hide PayU’s loader when PUCBWebVC loads the UIWebView. If enabled, it disappears just before the relevant bank page. Makes PayU Loader visible

               cbConfig.shouldShowPayULoader = YES;

Disable PayU Loader in this case.

               cbConfig.shouldShowPayULoader = NO;

isAutoOTPSelect You can choose to select it if you want to always select OTP as method of authentication on bank page. Allow AutoOTP select if select to YES.

               cbConfig.isAutoOTPSelect = YES;

Disallow AutoOTP select if selected NO.

               cbConfig.isAutoOTPSelect = NO;


You also have to pass us the following parameters:


Parameter Description Example
key Prod merchant key as provided by PayU “0MQaQP”
txnid’ Reference ID/ order ID as generated at your end. “20160826”

Sample code with default values of the configurations is as follows:

Custom Browser callbacks

Response handling: If you need the response of payment (success/failure/error), you need to confirm to protocol ‘PUCBWebVCDelegate’. The class in which you create PUCBWebVC object would generally be the delegate.

1. Following methods need to be implemented for response handling:


Callback Description Method
Success response Is called after a successful transaction.

Provide merchant payu response (response provided by payu) and merchant response (merchant wants to pass data through surl)

where, merchant will receive the payuresponse for all transaction and merchant response depends on surl provided by merchant

  • (void)PayUSuccessResponse:(id)response;
failure response Is called after the failed transaction.

Provides merchant payu response and merchant response.

Where, merchant will receive the payuresponse for all the transaction and merchant response depending on the furl provided by merchant

  • (void)PayUFailureResponse:(id)response;
CB error received Is called when some error occur in CB.
  • (void)PayUConnectionError:(NSDictionary *)notification;
Back dismiss Is called when backButton is dismiss. So that merchant can handle the dismiss event of the alert and do the needful
    • (void)shouldDismissVCOnBackPress; // This is an optional delegate method

Sample code with callbacks implemented:

Still have questions?

Our team will be more than happy to help you. You can reach out to them at