'Not getting Razor pay Signature and Order ID in iOS
I have integrated the code of Razor pay, but after adding Order_id
which I got from Web service Response, I am just getting Payment Id, but not getting Razor pay Signature.
Here is my code:
var razorpayObj : RazorpayCheckout? = nil
let razorpayKey = ""
//RazorpayPaymentCompletionProtocolWithData:
razorpayObj = RazorpayCheckout.initWithKey(razorpayKey, andDelegateWithData: self)
let options: [String:Any] = [
"prefill": [
"contact": "",
"email": ""],
"image": image,
"amount" : amount, // 100 rs - 1 rs
"name": name,
"order_id" : OrderId,
"theme": [
"color": "#01A6F6"
]
]
if let rzp = self.razorpayObj {
rzp.open(options)
} else {
print("Unable to initialize")
}
extension HomeVC : RazorpayPaymentCompletionProtocolWithData {
func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
print("error: ", code, str)
self.presentAlertJustMsg(withTitle: "", 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.presentAlertJustMsg(withTitle: "", message: "Payment Succeeded")
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|