【发布时间】:2020-12-19 11:39:05
【问题描述】:
在 Razorpay 的测试和直播模式下,我只得到了成功方法中的payment_id。我无法获得razorpay_signature 和razorpay_order_id。
我已使用RazorpayPaymentCompletionProtocolWithData 委托来获得我的结果。
这是我的代码:
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"]
}
}
【问题讨论】:
标签: ios objective-c swift razorpay