简体   繁体   English

braintree使用测试信用卡进行3D安全交易

[英]braintree use test credit card for 3D secure transaction

am trying to implement 3D secure payment in braintree sandbox but getting this error and unable to figure out what is wrong with code . 我试图在braintree沙箱中实现3D安全支付,但是得到这个错误并且无法弄清楚代码有什么问题。

Is it possible to make 3D secure transaction using test credit card. 是否可以使用测试信用卡进行3D安全交易。

How to show error if response have some error 如果响应有一些错误,如何显示错误

lookup response : 查找响应:

{"paymentMethod":{"type":"CreditCard","nonce":"5b721a96-8db5-07ba-55b1-d6546239d2b9","description":"ending in 11","isLocked":false,"securityQuestions":["cvv"],"details":{"cardType":"MasterCard","lastTwo":"11","lastFour":"0011"},"threeDSecureInfo":{"liabilityShifted":false,"liabilityShiftPossible":false,"status":"authentication_unavailable","enrolled":"U"},"consumed":false,"default":false,"hasSubscription":false,"binData":{"prepaid":"Unknown","healthcare":"Unknown","debit":"Unknown","durbinRegulated":"Unknown","commercial":"Unknown","payroll":"Unknown","issuingBank":"Unknown","countryOfIssuance":"Unknown","productId":"Unknown"}},"threeDSecureInfo":{"liabilityShifted":false,"liabilityShiftPossible":false},"lookup":{"acsUrl":null,"md":"tf6v87wpjpwtdydgbm","termUrl":"https://api.sandbox.braintreegateway.com:443/merchants/jd8k25qkwvyhngp2/client_api/v1/payment_methods/5b721a96-8db5-07ba-55b1-d6546239d2b9/three_d_secure/authenticate?authorization_fingerprint=15ed71ef406740a812f5e8ccca7302f2ffebd7ded88685faaadd287ef2b118e1%7Ccreated_at%3D2018-06-09T18%3A03%3A23.177132032%2B0000%26customer_id%3Dcustomer_4%26merchant_id%3Djd8k25qkwvyhngp2%26public_key%3Dzm5kmgjkx2hbyn3r\u0026authorization_fingerprint_64=MTVlZDcxZWY0MDY3NDBhODEyZjVlOGNjY2E3MzAyZjJmZmViZDdkZWQ4ODY4NWZhYWFkZDI4N2VmMmIxMThlMXxjcmVhdGVkX2F0PTIwMTgtMDYtMDlUMTg6MDM6MjMuMTc3MTMyMDMyKzAwMDAmY3VzdG9tZXJfaWQ9Y3VzdG9tZXJfNCZtZXJjaGFudF9pZD1qZDhrMjVxa3d2eWhuZ3AyJnB1YmxpY19rZXk9em01a21namt4MmhieW4zcg%3D%3D","pareq":null}}

My code: 我的代码:

<script src="{{ URL::asset('theme/js/jquery.min.js') }}"></script>    
<script src="https://js.braintreegateway.com/web/3.34.0/js/client.min.js"></script>    
<!-- Load the 3D Secure component. -->
<script src="https://js.braintreegateway.com/web/3.34.0/js/three-d-secure.min.js"></script>    
<script type="text/javascript">
        function showCardDetail(id){
    $('#card-detail').hide();
    if(id==3){
      $('#card-detail').show();
          }
     }
       $("#paymentForm").submit(function(e) {
         var paymentMethod = $("input[name='payment_method']:checked").val();
         if(paymentMethod==3){
           var holderName = $('#holderName').val();
        var holderCreditCardNumber = $('#holderCreditCardNumber').val();
        var customer_credit_card_expiration_date = $('#customer_credit_card_expiration_date').val();
        var customer_credit_card_cvv = $('#customer_credit_card_cvv').val();
         $.get( "{{ route('ajaxGenerateNonce')}}",{ 
        holderName:holderName, 
        holderCreditCardNumber:holderCreditCardNumber, 
customer_credit_card_expiration_date:customer_credit_card_expiration_date, 
        customer_credit_card_cvv:customer_credit_card_cvv}, function(data) {

        console.log(data.clientToken);
        console.log(data.nonce);
        braintree.client.create({
          // Use the generated client token to instantiate the Braintree client.
          authorization: data.clientToken
        }, function (clientErr, clientInstance) {
          if (clientErr) {
            return;
          }
          braintree.threeDSecure.create({
            client: clientInstance
          }, function (threeDSecureErr, threeDSecureInstance) {
            if (threeDSecureErr) {
              return;
            }
            verifyCard(threeDSecureInstance,data );
          });
        });         
      });
        e.preventDefault();
      }  
    })
function verifyCard(threeDSecure, data){
var my3DSContainer = document.createElement('div');  
        threeDSecure.verifyCard({amount: '500.00',nonce: data.nonce,
          addFrame: function (err, iframe) {
            my3DSContainer.appendChild(iframe);
            document.body.appendChild(my3DSContainer);
          },
          removeFrame: function () {
            // Remove UI that you added in addFrame.
            document.body.removeChild(my3DSContainer);
          }
        }, function (err, response) {
            console.log(response);
              // Send response.nonce to use in your transaction
        });
    }
    </script>

Based on the lookup response you provided, it doesn't look like you're using the 3D Secure-specific test cards. 根据您提供的查找响应,您看起来并不像使用3D安全专用测试卡。 I recommend using this Cardinal Consumer Authentication Test Cases Guide for testing 3D Secure in the sandbox environment. 我建议使用此Cardinal Consumer Authentication Test Cases Guide来测试沙箱环境中的3D Secure。

To show errors when they occur, I recommend logging them to your console. 要在出现错误时显示错误,我建议将它们记录到您的控制台。 Currently, you have your code set to return if an error occurs at any level. 目前,如果在任何级别发生错误,您都可以将代码设置为返回。 You can update it to log the error with something like this: 您可以更新它以使用以下内容记录错误:

if (clientErr) {
  console.error(clientErr);
  return;
}

You can do this for each instance of the errors you've included, such as threeDSecureErr . 您可以为包含的每个错误实例执行此操作,例如threeDSecureErr If you continue to have problems, feel free to reach out to Support at support@braintreepayments.com. 如果您仍然遇到问题,请随时通过support@braintreepayments.com与我们联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM