[Support request] braintree payment

Home Forums Support braintree payment

  • This topic has 1 reply, 2 voices, and was last updated 11 months ago by David.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1050454
    Klaus

    Hello, I would like to integrate braintree-payments into my webshop. I need to integrate this code:

    <head>
    <meta charset=”utf-8″>
    <script src=”https://js.braintreegateway.com/web/dropin/1.20.4/js/dropin.min.js”></script&gt;
    </head>
    <body>

    <button id=”submit-button”>Request payment method</button>
    <script>
    var button = document.querySelector(‘#submit-button’);

    braintree.dropin.create({
    authorization: ‘CLIENT_TOKEN_FROM_SERVER’,
    container: ‘#dropin-container’
    }, function (createErr, instance) {
    button.addEventListener(‘click’, function () {
    instance.requestPaymentMethod(function (err, payload) {
    // Submit payload.nonce to your server
    });
    });
    });
    </script>
    </body>

    I guess I could do this with a head-element and a body-element, right?

    And then I need to integrate this code into my template:

    braintree.dropin.create({
    authorization: CLIENT_TOKEN_FROM_SERVER,
    container: ‘#dropin-container’
    }, function (err, instance) {
    /* … */
    });

    Do you have any idea where to put this code? Thanks Klaus

    #1050597
    David
    Staff
    Customer Support

    Hi there,
    Apart from the button you can use Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    Hook# 1 for the <head></head> tag could – select the WP_header hook.
    Hook# 2 for the two scripts would go in the WP_footer hook.

    The button you would just add that code to your page content where you want the button to be displayed.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.