0
votes

The below code is embedded in PHP. Currently the dropin UI container is getting displayed however we not able to see the Pay button. We tried creating a custom button and tried the transaction but it lands to the checkout page, which is not found as i think everything needs to be handled by dropin UI Container.

Code:

<html>
           <head>
               <title>Payment</title>
               <script src="https://js.braintreegateway.com/v2/braintree.js"></script>
               <script>
                   braintree.setup("<?php echo $clientToken; ?>", "dropin", {
                       container: "dropin-container",
                        paypal: {
                          singleUse: true,
                           amount: <?php echo $array["amount"]; ?>,
                           currency: 'USD'
                       }
                   });
               </script>
           </head>
           <body>
               <form id="checkout" method="post" action="/checkout">
                   <div id="dropin-container"></div>
                   <input type="submit" value="Pay <?php echo $array["amount"]; ?>">
               </form>
           </body>
       </html>
1

1 Answers

2
votes

Disclaimer: I'm a developer at Braintree.

When implementing Drop-in, you still need to make sure to include a button (like you did in the code example above). Additionally, you'll need to set the form action to a valid destination on your site. The Drop-in eventually triggers a submit on the actual form, so the form's action needs to be defined properly. If you haven't yet built the server side component to handle the response from the Drop-in, check out our Hello Server guide, which covers how to handle the payment method nonce returned from the Drop-in.

If you have any other questions related to this, I highly recommend reaching out to the awesome Braintree support team for additional help.