Git Product home page Git Product logo

braintree-web-drop-in's Introduction

Braintree Web Drop-in

A pre-made payments UI for accepting cards and alternative payments in the browser built using version 3 of the Braintree JS client SDK.

If you have any feedback or questions, create an issue or contact Braintree support.

What's new

  • Updated UI to easily accommodate multiple payment methods
  • Not in an iframe; feel free to style Drop-in to blend in with your website
  • Now available in 23 languages
  • Open source and open development

Getting started

For setup and usage, see our reference.

Full example

This is a full example of a Drop-in integration that only accepts credit cards.

<!DOCTYPE html>
<html lang="en">
 <head>
   <meta charset="UTF-8">
   <title>Checkout</title>
 </head>
 <body>
   <div id="dropin-container"></div>
   <button id="submit-button">Purchase</button>

   <script src="https://js.braintreegateway.com/web/dropin/1.16.0/js/dropin.min.js"></script>

   <script>
     var submitButton = document.querySelector('#submit-button');

     braintree.dropin.create({
       authorization: 'CLIENT_AUTHORIZATION',
       selector: '#dropin-container'
     }, function (err, dropinInstance) {
       if (err) {
         // Handle any errors that might've occurred when creating Drop-in
         console.error(err);
         return;
       }
       submitButton.addEventListener('click', function () {
         dropinInstance.requestPaymentMethod(function (err, payload) {
           if (err) {
             // Handle errors in requesting payment method
           }

           // Send payload.nonce to your server
         });
       });
     });
   </script>
 </body>
</html>

Browser support

Drop-in is supported in all browsers supported by the Braintree JavaScript Client SDK.

Customization

The design of Drop-in is intentionally opinionated, and while we aimed to make the design work in many scenarios, the design of your website may conflict with the default design of Drop-in.

For minor UI customizations, review our documentation.

For more substantial changes, you may fork Drop-in, make your desired changes and build the assets by running npm run build. By default, Drop-in uses a hosted version of the built stylesheet. To override this behavior and use a custom stylesheet instead, simply add <link> tag to your page with the id braintree-dropin-stylesheet.

Drop-in uses the Braintree JavaScript SDK. So if a fully customized UI is what you're looking for, Drop-in may be used as a reference implementation for using the JavaScript SDK.

Releases

Subscribe to our Google Group to be notified when SDK releases go out.

License

Drop-in is open source and available under the MIT license. See the LICENSE file for more info.

braintree-web-drop-in's People

Contributors

braintreeps avatar crookedneighbor avatar lilaconlee avatar evanhahn avatar skunkworks avatar quinnjn avatar intelliot avatar julka avatar juongithub avatar kzurawel avatar jaypatel512 avatar danakatz avatar davekc avatar rhymond avatar clashthebunny avatar plevetsky avatar maxsz avatar jacobwb avatar jackellenberger avatar flipjms avatar dpolivy avatar billy-reilly avatar

Watchers

James Cloos avatar Petronel MALUTAN (p.m) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.