首页 > 解决方案 > ios Swift中的Paytm付款缺少参数问题

问题描述

我正在尝试将 Paytm 支付集成到 iOS 应用程序中。当我尝试将参数传递给 pgtransaction 时,我收到错误消息 CUST_ID 参数丢失。但我正在传递那把钥匙。请参阅下面的实现代码:

func beginPayment()
    {
        productionInstance = productionInstance.createProductionEnvironment()
        let useMobiNumb = userMobileNumber.dropFirst()
        print(useMobiNumb)
        let type :ServerType = .eServerTypeProduction
        let order = PGOrder(orderID: "", customerID: "", amount: "", eMail: "", mobile: "")
        order.params = ["MID": MID,"ORDER_ID": orderId!,"CUST_ID": useMobiNumb,"CHANNEL_ID": "WAP","WEBSITE": "VMartP","TXN_AMOUNT": orderValue!,"INDUSTRY_TYPE_ID": IndustryTypeId,"CHECKSUMHASH": checkSumHash!,"CALLBACK_URL": "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=\(String(describing: orderId!))"]
        self.txnController =  self.txnController.initTransaction(for: order) as! PGTransactionViewController
        self.txnController.title = "Paytm Payments"
        self.txnController.setLoggingEnabled(true)
        if(type != ServerType.eServerTypeNone)
        {
            self.txnController.serverType = type;
        }
        else
        {
            return
        }
        self.txnController.merchant = PGMerchantConfiguration.defaultConfiguration()
        self.txnController.delegate = self
        self.navigationController?.pushViewController(self.txnController, animated: true)
    }

我在调试区域收到这条消息:

PGTransactionViewController::initWithTransactionParameters: ["ORDER_ID": "Order_26122018158277", "CHANNEL_ID": "WAP", "INDUSTRY_TYPE_ID": "Retail109", "CALLBACK_URL": "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=Optional(\"Order_26122018158277\")", "CUST_ID": "918309909071", "TXN_AMOUNT": "27.00", "WEBSITE": "WEBSTAGING", "MID": "VMartP95907532925453", "CHECKSUMHASH": "YCd9N8GZYfYvyFGlBpdNnnEqMYhtWio2l9z3IjrqW2qsaG3l6ZiO6cP6zNBBZTRNSyePm5WV0/bm7zw77mMIKv45g6TrWPEuWFa8qe3yDSw="]
PGTransactionViewController:loadView
PGTransactionViewController::viewDidLoad
PGTransactionViewController::viewWillAppear
PGTransactionViewController::viewDidAppear
Calling Delegate errorMisssingParameter
Optional(Error Domain=com.paytm.payments Code=-1 "MissingKeys" UserInfo={NSLocalizedRecoveryOptions=(
    OK
), NSLocalizedDescription=MissingKeys, NSLocalizedFailureReason=CUST_ID is/are missing parameters.})

谁能告诉我哪里出错了?谢谢

标签: swiftpayment-gatewaypaytm

解决方案


ORDER_ID : long(1553684683)

由于这个long关键字,我们都面临这个问题。因此,将其更改为 String 并传递给 SDK。

例子:

"CUST_ID": "918309909071"
"ORDER_ID" : "1553684683"

推荐阅读