检查您的工程是否包含了Adyen Drop In SDK。
如果您的工程已经包含了Adyen Drop In SDK,请检查您的代码是否正确引用了SDK。 例如,在您的 Podfile 中添加以下内容:
pod 'Adyen', '~> 3.5.0'
然后运行pod install以安装新的 SDK。
例如,以下代码展示了如何初始化Adyen Drop In:
class ViewController: UIViewController, DropInComponentDelegate {
var dropInComponent: DropInComponent!
override func viewDidLoad() {
super.viewDidLoad()
let configuration = DropInComponent.PaymentMethodsConfiguration()
configuration.card.publicKey = "YOUR_PUBLIC_KEY"
dropInComponent = DropInComponent(paymentMethodsConfiguration: configuration)
dropInComponent.delegate = self
addChild(dropInComponent)
view.addSubview(dropInComponent.view)
dropInComponent.didMove(toParent: self)
}
func didSubmit(_ data: PaymentComponentData, from component: DropInComponent) {
// Handle the payment result
}
func didProvide(_ data: ActionComponentData, from component: DropInComponent) {
// Handle action data requests, such as 3D Secure authentication
}
func didFail(with error: Error, from component: DropInComponent) {
// Handle error
}
}
注意:要正确使用Adyen Drop In,您需要在Adyen网站上注册并获取公钥。