本文介绍了result.credit_card_verification即使在braintree错误时也返回零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我正在使用braintree进行付款处理,并且试图获取处理器响应代码(来自Braintree和Ruby)。I'm using braintree for payment processing and I'm trying to get Processor Response Codes from Braintree with Ruby.这是我的代码: verification = result.credit_card_verification response_code = verification.try(:processor_response_code)即使在还有其他获取处理器响应代码的东西吗?Is there something else to get Processor Response Codes?我从此处这里是我的result.erros:Here is my result.erros ::errors: !ruby/object:Braintree::Errors errors: !ruby/object:Braintree::ValidationErrorCollection errors: [] nested: :customer: !ruby/object:Braintree::ValidationErrorCollection errors: [] nested: :credit_card: !ruby/object:Braintree::ValidationErrorCollection errors: - !ruby/object:Braintree::ValidationError code: '81707' attribute: cvv message: CVV must be 4 digits for American Express and 3 digits for other card types. - !ruby/object:Braintree::ValidationError code: '81713' attribute: expiration_year message: Expiration year is invalid. - !ruby/object:Braintree::ValidationError code: '81703' attribute: number message: Credit card type is not accepted by this merchant account. - !ruby/object:Braintree::ValidationError code: '81715' attribute: number message: Credit card number is invalid. nested: :billing_address: !ruby/object:Braintree::ValidationErrorCollection errors: [] nested: {}推荐答案 我在Braintree工作。如果您想要获得比堆栈溢出更多的帮助,请联系我们的支持团队。处理 Braintree结果对象是渐进的。如果 result.success?是 false ,然后检查 result.errors ,它们表示验证错误。If result.success? is false, then you check for result.errors, which represent validation errors.如果 result.errors 是 nil ,则请求有效。在这种情况下,您将拥有交易或验证对象,就像 result.success ?是 true 。If result.errors is nil, then the request was valid. In this case, you will have a transaction or verification object just as if result.success? was true.然后您可以查看 result.verification 的状态, processor_response_code , gateway_rejection_reason 等。You can then look at the result.verification's status, processor_response_code, gateway_rejection_reason, etc.链接的文档提供了有关处理错误结果的更多详细信息。The linked documentation provides more details on handling error results. 这篇关于result.credit_card_verification即使在braintree错误时也返回零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-07 16:31