When I called Braintree::Transaction.sale with the "payment_method_nonce" which created by Drop-in UI, everything is alright. However, after I added some custom fields in the Drop-in UI and call the same API, I got an error "CVV must be 4 digits for American Express and 3 digits for other card types". I'm quite sure the CVV should be correct... Does anyone have idea on this error?
iOS client side implementation:
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)
}
}
}
Ruby server side:
result = Braintree::Transaction.sale(
:amount => "15.00",
:payment_method_nonce => nonce_from_the_client,
:options => {
:submit_for_settlement => true
}
)