Search code examples
phpiosswiftlaravelpayumoney

What should be the sUrl and fUrl - PayU Money iOS integration


I have successfully integrated PayU money mobile sdk. What I want is once transaction is completed I want to notify my server about the transaction state.

This can be done via txnParam.surland txnParam.furl. when I set like this...

txnParam.surl = "http://staging.myserver.com/payu-success.php"
txnParam.furl = "http://staging.myserver.com/payu-fail.php"

I am getting Invalid sUrl in response from PayU money mobile sdk and not able to do the transaction.

But when I set like this...

txnParam.surl = "https://www.payumoney.com/mobileapp/payumoney/success.php"
txnParam.furl = "https://www.payumoney.com/mobileapp/payumoney/failure.php"

I am able to do transaction and I am getting the success response from PayU money. But how can I notify this to my server?

My Code

    let txnParam = PUMTxnParam()
    PlugNPlay.setDisableCompletionScreen(true)

    txnParam.phone = "1111111111"
    txnParam.email = "[email protected]"
    txnParam.amount = "2550.0"
    txnParam.environment = PUMEnvironment.test
    txnParam.firstname = "test test"
    txnParam.key = kMerchentKey

    txnParam.merchantid = "5675943"
    txnParam.txnID = "1234567890"
//        txnParam.surl = "https://www.payumoney.com/mobileapp/payumoney/success.php"
//        txnParam.furl = "https://www.payumoney.com/mobileapp/payumoney/failure.php"
    txnParam.surl = "http://staging.myserver.com/payu-success.php"
    txnParam.furl = "http://staging.myserver.com/payu-fail.php"

    txnParam.productInfo = "Test Product"
    txnParam.udf1 = "ud1"
    txnParam.udf2 = "ud2"
    txnParam.udf3 = "ud3"
    txnParam.udf4 = "ud4"
    txnParam.udf5 = "ud5"
    txnParam.udf6 = ""
    txnParam.udf7 = ""
    txnParam.udf8 = ""
    txnParam.udf9 = ""
    txnParam.udf10 = ""

Setting hash value got from server

txnParam.hashValue = serverHashValue

Presenting PlugNPlay view controller

PlugNPlay.presentPaymentViewController(withTxnParams: txnParam, on: self) { (response, error, extraParam) in
        print(response as Any)
        print(error as Any)
    }

Backend: PHP(Laravel Framework)


Solution

  • The reason of getting sUrl is invalid is DASH(-) in the url.

    http://staging.myserver.com/payu-success.php.

    Once I have set url like this...

    http://staging.myserver.com/payu_success.php

    It works gracefully.

    But surprisingly http://staging.myserver.com/payu-success.php url (with dash) is working fine on ANDROID platform. :-O

    But in iOS it was giving me wrong sUrl.

    This thing is not documented by PayU money

    So ultimately the funny thing is that after hours of trial and error finally get to know that

    DON'T USE DASH IN URL WHILE INTEGRATING PAYU MONEY IN IOS:D

    Hope it will help other