1

我正在将PayTM集成到我的ios (Swift)应用程序中,我面临标题为“ Transaction Failed ”且消息为“ MissingKeys ”的问题

在此处输入图像描述

我使用了以下代码

    merchant = PGMerchantConfiguration.default()!

    merchant.checksumGenerationURL = "http://getlook.in/cgi-bin/checksum_generate.cgi"
    merchant.checksumValidationURL = "http://getlook.in/cgi-bin/checksum_validate.cgi"

    merchant.clientSSLCertPath = nil
    merchant.clientSSLCertPassword = nil

    merchant.merchantID = "rriver57770575448885"
    merchant.website = "APP_STAGING"
    merchant.industryID = "Retail"
    merchant.channelID = "WAP"

    var orderDict = [String: String]()

    orderDict["MID"] = "rriver57770575448885" // Merchant ID
    orderDict["CHANNEL_ID"] = "WAP" // Channel Id
    orderDict["INDUSTRY_TYPE_ID"] = "Retail" // Industry Type

    orderDict["WEBSITE"] = "APP_STAGING"
    orderDict["TXN_AMOUNT"] = "10"; // amount to charge                      // mandatory
    orderDict["ORDER_ID"] = "\(Date().timeIntervalSince1970)";//change order id every time on new transaction
    orderDict["REQUEST_TYPE"] = "DEFAULT";// remain same
    orderDict["CUST_ID"] = "123456789027"; // change acc. to your database user/customers
    orderDict["MOBILE_NO"] = "8798987874";// optional
    orderDict["EMAIL"] = "test@paytm.com"; //optional

    let pgOrder = PGOrder(params: orderDict)

    let transaction = PGTransactionViewController.init(transactionFor: pgOrder)

    transaction?.serverType = eServerTypeProduction
    transaction?.merchant = merchant
    transaction?.loggingEnabled = true
    transaction?.delegate = self
    self.present(transaction!, animated: true, completion: nil)

请帮忙!

4

1 回答 1

1

在这段代码中,您错过了一个名为 chechSumHash 的参数。也包括在内。

orderDict["CHECKSUMHASH"] = CheckSum;

checkSumHash 可以在 Paytm 校验和生成工具包的帮助下在后端生成。校验和是一个唯一的字符串,它将根据我们为校验和生成 Api 发送的参数而改变

于 2018-03-21T07:42:57.270 回答