【发布时间】:2020-01-08 10:26:35
【问题描述】:
我正在使用stpaddcardviewcontroller UI 元素要求客户输入新卡信息
let addCardViewController = STPAddCardViewController()
addCardViewController.delegate = self
present(navigationController, animated: true)
上面的代码将显示UI,但在点击完成按钮后,我需要获取令牌(从添加的卡信息生成)以向现有客户添加新卡/来源。
我正在使用以下委托方法从stpaddcardviewcontroller UI 获取令牌
extension viewController : STPAddCardViewControllerDelegate {
func addCardViewControllerDidCancel(_ addCardViewController: STPAddCardViewController) {
dismiss(animated: true)
}
func addCardViewController(_ addCardViewController: STPAddCardViewController, didCreatePaymentMethod paymentMethod: STPPaymentMethod, completion: @escaping STPErrorBlock) {
dismiss(animated: true)
}
如何在委托方法中接收卡令牌?这样我就可以传递给Add Card API ?
【问题讨论】:
标签: ios swift stripe-payments