swift - 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.})
谁能告诉我哪里出错了?谢谢
解决方案
ORDER_ID : long(1553684683)
由于这个long
关键字,我们都面临这个问题。因此,将其更改为 String 并传递给 SDK。
例子:
"CUST_ID": "918309909071"
"ORDER_ID" : "1553684683"
推荐阅读
- javascript - 从 html 视频元素到小的屏幕截图
- python - 在数据框列中搜索字符串模式,返回每个出现并加入另一个数据框
- swift - 在 Swift 中浮动的 Uint8 数组
- java - FireBaseListAdapter的Android工作室错误
- sql-server - 使用 Azure AD 时审核 SQL 表
- php - SQLSTATE [HY000]:一般错误:1364 字段“名字”没有默认值(SQL:插入“用户”(“电子邮件”)值(test@test.com))
- python - 如何避免模型在 keras Tensorflow 中变成层
- ios - CoreData派生属性查看一对多关系是否包含属性
- pandas - 在 Pandas 中操作列时出现内存错误
- java - Spring ApplicationEvent onApplicationEvent 方法