Ios onPaymentSuccess的成功方法中没有Razorpay签名和订单ID
在Razorpay的测试和直播模式下,我只获得成功方法中的Ios onPaymentSuccess的成功方法中没有Razorpay签名和订单ID,ios,objective-c,swift,razorpay,Ios,Objective C,Swift,Razorpay,在Razorpay的测试和直播模式下,我只获得成功方法中的付款id。我无法获得razorpay\u签名和razorpay\u订单\u id 我使用了razorpaymentcompletionprotocolwithdata委托来获得结果 这是我的代码: extension ViewController: RazorpayPaymentCompletionProtocolWithData { func openRazorpayCheckout(){ //Register Razorp
付款id
。我无法获得razorpay\u签名和razorpay\u订单\u id
我使用了razorpaymentcompletionprotocolwithdata
委托来获得结果
这是我的代码:
extension ViewController: RazorpayPaymentCompletionProtocolWithData {
func openRazorpayCheckout(){
//Register RazorpayTestKey
razorpay = RazorpayCheckout.initWithKey(kRazorpayLiveKey, andDelegateWithData: self)
let options: [String:Any] = [
"description": ServerConfig.shared.businessDescription!,
"order_id": viewModel.model.orderID!,
"image": ServerConfig.shared.businessImage!,
"name": ServerConfig.shared.businessName!,
"prefill": [
"contact": LoggedInUser.shared.phoneNumber!,
"email": LoggedInUser.shared.email!
]
]
if let rzp = razorpay {
rzp.open(options)
} else {
print("Unable to initialize")
}
}
func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
_ = response!["razorpay_payment_id"]
_ = response!["razorpay_order_id"]
_ = response!["razorpay_signature"]
}
func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
_ = response!["razorpay_payment_id"]
_ = response!["razorpay_order_id"]
_ = response!["razorpay_signature"]
}
}
如果你没有得到签名,这意味着你的订单id可能是错误的,交叉检查你的订单id。我在android上犯了同样的错误。我没有传递导致签名为空的订单id。如果你没有得到签名,这意味着你的订单id可能是错误的,请交叉检查你的订单id。我在android中犯了同样的错误。我没有传递导致空签名的订单id。用响应保存了我的日期:
如果你没有得到签名,这意味着你的订单id可能是错误的,交叉检查你的订单id。我在android上犯了同样的错误。我没有传递导致空签名的订单id
请务必传递正确的订单id。然后您可以尝试。您需要更改并委派给andDelegateWithData
// razorpay = RazorpayCheckout.initWithKey(razorpayTestKey, andDelegate: self)
razorpay = RazorpayCheckout.initWithKey("razorpayTestKey", andDelegateWithData: self)
Then Use RazorpayPaymentCompletionProtocolWithData:
扩展视图控制器:RazorPaymentCompletionProtocolWithData{
func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
print("error: ", code)
// self.presentAlert(withTitle: "Alert", message: str)
}
func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
print("success: ", payment_id)
print("Response is: ", (String(describing: response)))
let paymentId = response?["razorpay_payment_id"] as! String
let rezorSignature = response?["razorpay_signature"] as! String
print("rezorSignature", rezorSignature)
print(" paymentId", paymentId)
//self.presentAlert(withTitle: "Success", message: "Payment Succeeded")
}
}用以下回复保存了我的一天:
如果你没有得到签名,这意味着你的订单id可能是错误的,交叉检查你的订单id。我在android上犯了同样的错误。我没有传递导致空签名的订单id
请务必传递正确的订单id。然后您可以尝试。您需要更改并委派给andDelegateWithData
// razorpay = RazorpayCheckout.initWithKey(razorpayTestKey, andDelegate: self)
razorpay = RazorpayCheckout.initWithKey("razorpayTestKey", andDelegateWithData: self)
Then Use RazorpayPaymentCompletionProtocolWithData:
扩展视图控制器:RazorPaymentCompletionProtocolWithData{
func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
print("error: ", code)
// self.presentAlert(withTitle: "Alert", message: str)
}
func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
print("success: ", payment_id)
print("Response is: ", (String(describing: response)))
let paymentId = response?["razorpay_payment_id"] as! String
let rezorSignature = response?["razorpay_signature"] as! String
print("rezorSignature", rezorSignature)
print(" paymentId", paymentId)
//self.presentAlert(withTitle: "Success", message: "Payment Succeeded")
}
}