当我使用" payment_method_nonce"来调用Braintree :: Transaction.sale时由Drop-in UI创建,一切都很好。 但是,在我在Drop-in UI中添加了一些自定义字段并调用相同的API后,我收到错误" CVV必须是4位数字用于美国运通,3位用于其他卡类型"。 我很确定CVV应该是正确的...... 有没有人对这个错误有所了解?
iOS客户端实施:
'Signal SIGABRT'
Ruby服务器端:
internal func tokenizeCreditCard(creditCard: CreditCard, completion: @escaping NerfireAPICompletionBlock) {
// For client authorization,
// get your tokenization key from the control panel
// or fetch a client token
let braintreeClient = BTAPIClient(authorization: <sandbox_token>)!
let cardClient = BTCardClient(apiClient: braintreeClient)
let card = BTCard(number: creditCard.number!, expirationMonth: creditCard.month!, expirationYear: creditCard.year!, cvv: creditCard.verificationValue!)
cardClient.tokenizeCard(card) { (tokenizedCard, error) in
if error != nil {
completion(nil, error as NSError?)
}else {
completion(tokenizedCard, nil)
}
}
}