当我打电话给Braintree :: Transaction.sale时,得到错误" CVV必须是美国运通4位数和其他卡类型3位数"

时间:2016-12-19 11:00:59

标签: braintree braintree-rails braintree-sandbox

当我使用" 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)
        }
    }
}

0 个答案:

没有答案