Braintree PCI合规性问题

时间:2018-11-19 07:16:30

标签: paypal braintree pci-compliance

我一直在不断地收到关于PCI合规性方面问题的电子邮件,需要就以下两件事进行确认。

我们网站上的Braintree付款集成方式是什么? (提示:这是其中之一)

  1. 拖放到用户界面或托管字段中
  2. Braintree SDK自定义集成

以下是我们使用的javascript代码。在这方面,我浏览了Braintree网站,但无法得出结论。

附加说明:我们对Braintree供应商文件进行了一些更改。

var subscribed_user = "1";

$('#cc').on('click', function (e) {
    $('#cc-info').show().attr('aria-hidden', true).css('visibility', 'visible');
});
var button = document.querySelector('#paypal-button');
var button1 = document.querySelector('#card-button');
var form = document.querySelector('#checkout-form');
var authorization = 'AuthHeaderxxxxxxxx=';


// Create a client.
braintree.client.create({
    authorization: authorization
}, function (clientErr, clientInstance) {

    // Stop if there was a problem creating the client.
    // This could happen if there is a network error or if the authorization
    // is invalid.
    if (clientErr) {
        console.error('Error creating client:', clientErr);
        return;
    }
    /* Braintree - Hosted Fields component */
    braintree.hostedFields.create({
        client: clientInstance,
        styles: {
            'input': {
                'font-size': '10pt',
                'color': '#e3e3e3 !important; ',
                'border-radius': '0px'

            },
            'input.invalid': {
                'color': 'red'
            },
            'input.valid': {
                'color': 'green'
            }
        },
        fields: {
            number: {
                selector: '#card-number',
                placeholder: '4111 1111 1111 1111',

            },
            cvv: {
                selector: '#cvv',
                placeholder: '123'
            },
            expirationDate: {
                selector: '#expiration-date',
                placeholder: '10/2019'
            }
        }
    }, function (hostedFieldsErr, hostedFieldsInstance) {
        if (hostedFieldsErr) { /*Handle error in Hosted Fields creation*/
            return;
        }

        button1.addEventListener('click', function (event) {
            event.preventDefault();
            hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {
                if (tokenizeErr) { /* Handle error in Hosted Fields tokenization*/
                    document.getElementById('invalid-field-error').style.display = 'inline';
                    return;
                }
                /* Put `payload.nonce` into the `payment-method-nonce` input, and thensubmit the form. Alternatively, you could send the nonce to your serverwith AJAX.*/
                /* document.querySelector('form#bt-hsf-checkout-form input[name="payment_method_nonce"]').value = payload.nonce;*/
                document.querySelector('input[name="payment-method-nonce"]').value = payload.nonce;
                form.submit();
                button1.setAttribute('disabled', 'disabled');
            });
        }, false);
    });

    // Create a PayPal component.
    braintree.paypal.create({
        client: clientInstance,
        paypal: true
    }, function (paypalErr, paypalInstance) {

        // Stop if there was a problem creating PayPal.
        // This could happen if there was a network error or if it's incorrectly
        // configured.
        if (paypalErr) {
            console.error('Error creating PayPal:', paypalErr);
            return;
        }

        if ($('select#paypal-subs-selector option:selected').val() == '') {
            button.setAttribute('disabled', 'disabled');
        }
        $('select#paypal-subs-selector').change(function () {
            if ($('select#paypal-subs-selector option:selected').val() == '') {
                button.setAttribute('disabled', 'disabled');
            } else {
                // Enable the button.
                button.removeAttribute('disabled');
            }
        });


            button.addEventListener('click', function () {
                if(subscribed_user) {
                    // Popup Error for changing subscription.
                    swal({
                        html: true,
                        title: "",
                        text: "You are cancelling in the middle of subscription.<br/>If you do so you will not be refunded remaining days of your subscription.",
                        confirmButtonColor: '#605ca8',
                        confirmButtonText: 'Yes',
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "Proceed !",
                        closeOnConfirm: true
                    }, function (isConfirm) {
                        if (isConfirm) {
                            show_payment_methods(paypalInstance);
                        }
                    });
                } else{
                    show_payment_methods(paypalInstance);
                }
            }, false);

    });
});

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

您的代码显示Braintree - Hosted Field component,而且您不会使用通过搜索“ Braintree api”找到的类似this的东西。我认为您可以放心使用托管字段。

相关问题