Reputation: 247
I am unable to use UITextfield
data as currencyAmount in visa checkout.
i have taken CurrencyAmount's variable as a
and setting the itemMoney text to this variable.
What i am trying in my code:-
class ViewController: UIViewController {
@IBOutlet weak var itemMoney:UITextField!
@IBOutlet weak var lbl1:UILabel!
var a :Double = 0
@IBOutlet weak var checkoutButton:VisaCheckoutButton!
override func viewDidLoad() {
super.viewDidLoad()
a = Double(itemMoney.text!)!
let purschaseInfo = PurchaseInfo(total: a, currency: .usd)
purschaseInfo.reviewAction = .pay
checkoutButton.onCheckout(purchaseInfo: purschaseInfo) { result in
switch result.statusCode {
case .success:
print("Encrypted key: \(String(describing: result.encryptedKey))")
print("Payment Data \(String(describing: result.encryptedPaymentData))")
self.lbl1.text = "Payment sucessfull"
case .userCancelled:
print("Payment cancelled by user")
default:
break
}
}
Error :- Argument labels '(_:)' do not match any available overloads
Please help me
Upvotes: 0
Views: 104
Reputation: 3693
You are passing a Double
, but I see from the specs that PurchaseInfo
expects an object of type CurrencyAmount
(see section "Specifying payment details and launching Visa Checkout" from the official guide).
let total = CurrencyAmount(string: "1.00")
let purchaseInfo = PurchaseInfo(total: total, currency: .usd)
Upvotes: 2