PayTM SDK:交易失败

时间:2018-03-21 07:14:37

标签: ios swift paytm

我正在我的应用中整合 PayTM ,这是 ios(Swift),我面临的问题是什么标题是" 交易失败"消息是" MissingKeys "

enter image description here

我使用了以下代码

    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)

请帮忙!

1 个答案:

答案 0 :(得分:1)

在此代码中,您错过了一个名为chechSumHash的参数。包括那个。

orderDict["CHECKSUMHASH"] = CheckSum;

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