【问题标题】:Braintree Perl SDK- How to access $credit_card_verification result object in Customer->create API callBraintree Perl SDK-如何在 Customer->create API 调用中访问 $credit_card_verification 结果对象
【发布时间】:2014-09-28 10:45:54
【问题描述】:

我正在将 Braintree Perl 的 SDK(支付网关)与现有项目集成。在该项目中,我想返回 response_code、response_text。 CVV_response、AVS_response 对每个 Transaction->sale 和 Customer->create API 在成功和失败状态下调用。

我可以在 Transaction->sale API 调用和客户->create API call on failure status 中访问成功和失败状态的结果对象,但我无法访问如下所示的结果对象关于成功状态,

$result->credit_card_verification->status
$result->credit_card_verification->processor_response_code

当 Customer->create API 调用成功时,如何访问 $result->credit_card_verification 结果对象?

我也参考了下面的链接,但无法理解,

https://developers.braintreepayments.com/javascript+perl/reference/objects/customer https://developers.braintreepayments.com/javascript+perl/reference/objects/transaction https://github.com/braintree/braintree_perl/blob/master/lib/Net/Braintree/CreditCardVerification.pm

请找到我的示例代码的sn-p,

if ( $result->is_success ) {
    print "\nThe result is" . $result;
    print "\n" . $result->customer->id;

    #can't able to access these details here
    my $verification = $result->credit_card_verification;
    print $result->status;
    print $result->processor_response_code;
    print $verification->processor_response_text;

    $self->new_agreement_id( $result->customer->credit_cards->[0]->token );
    $self->collection_status( $status_codes{Authorized} );
    $self->status_text( $result->credit_card_verification->status );
    $self->status( $result->credit_card_verification->processor_response_code );
    $self->cvv_response( $result->credit_card_verification->cvv_response_code );
    $self->avs( $result->credit_card_verification->avs_postal_code_response_code );
}
else {
    print "\nResult is" . $result->errors . "\n";
    print "Message is:" . $result->message . "\n";

    #can able to access these details here
    my $verification = $result->credit_card_verification;
    print $verification->status;
    print $verification->processor_response_code;
    print $verification->processor_response_text;

    $self->collection_status( $status_codes{failed} );
    $self->status( $verification->processor_response_code );
    $self->cvv_response( $result->credit_card_verification->cvv_response_code );
    $self->avs( $result->credit_card_verification->avs_postal_code_response_code );
    $self->status_text( $verification->status );
}

在这里,我在我的客户中使用verify_card 选项->始终创建 API 调用。

感谢任何帮助。

【问题讨论】:

    标签: perl payment-gateway sandbox braintree


    【解决方案1】:

    我在布伦特里工作。如果您还有其他问题,请随时reach out to our support team

    成功后您无法获得信用卡验证对象。信用卡验证只会是returned if it failed

    客户或支付方式创建的结果可能包含验证结果对象。仅当验证运行并且验证返回processor_declinedgateway_rejected 时才会出现验证结果对象。成功的结果不会返回验证结果对象。

    【讨论】:

    • 感谢您的 cmets,但我必须找到其他方法来实现这一点,也许我应该对成功进行硬编码。
    • @Logunath 我建议你重新审视一下为什么你需要关于成功的信息;在这种情况下,它通常不会起到任何作用。
    • 这是我必须根据项目设计在每次 API 调用时返回的强制参数。
    猜你喜欢
    • 2011-06-08
    • 2012-12-30
    • 2012-08-23
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 2021-06-22
    • 1970-01-01
    相关资源
    最近更新 更多