Я пытаюсь внедрить безопасный 3D-платеж в песочнице Braintree, но получаю эту ошибку и не могу выяснить, что не так с кодом.
Возможно ли сделать безопасную 3D-транзакцию с помощью тестовой кредитной карты.
Как показать ошибку, если в ответе есть какая-то ошибка
Поиск ответа:
{"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}}
Мой код:
<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>