Giter Site home page Giter Site logo

braintree-web-drop-in's Introduction

Braintree Web Drop-in

Build Status Build Status Build Status

npm version

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.42.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.

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

armandodlvr avatar billwerges avatar braintreeps avatar cgdibble avatar crookedneighbor avatar danakatz avatar davekc avatar dependabot[bot] avatar epreuve avatar evanhahn avatar gesa avatar hollabaq86 avatar ibooker avatar intelliot avatar jackellenberger avatar jaypatel512 avatar jplukarski avatar julka avatar juongithub avatar kmaurisak avatar kzurawel avatar lilaconlee avatar oscarleonnogales avatar quinnjn avatar sancsalix avatar saralvasquez avatar scannillo avatar sestevens avatar skunkworks avatar tamtamchik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

braintree-web-drop-in's Issues

Paypal checkout question

General information

  • SDK/Library version: 3
  • Environment: Sandbox
  • Browser and OS: Chrome 58.0.3029.110 (64-bit) on MacOS 10.12.5

Issue description

I am in the process of integrating drop-in to my web page following your drop-in example as guideline with two payment types: credit card and paypal checkout. Credit card works great but I am having issue with Paypal checkout.

The problem with Paypal checkout is that when I hit Paypal checkout button it basically redirect me to Paypal checkout web page which just went through the whole payment process while my original form is still waiting the 'submit' button to be hit to move on to next step (calling requestPaymentMethod on drop-in instance, like what your example does).

I think there should be a way for my form to be notified when

  1. Payment method has been changed, and
  2. When Paypal checkout window is closed, either with sucess or with error.

Thanks.

Cardholder name is not present

Hey! Cardholder name is not present in the drop-in UI. Is this expected behaviour? This looks kind of unusual. Can the input field for cardholder name be enabled?

JSDoc task causes build to fail on windows

General information

  • SDK/Library version: unreleased (after 1.0.2)
  • OS: Windows 8.1 64-bit

Issue description

When I run 'npm run build' I see the errors:

[15:20:26] Using gulpfile [PATH]\braintree-web-drop-in\gulpfile.js

[15:20:26] Starting 'build'...
[15:20:26] Starting 'clean'...
[15:20:26] Finished 'clean' after 93 ms
[15:20:26] Starting 'build:js:unmin'...
[15:20:26] Starting 'build:js:min'...
[15:20:26] Starting 'build:css'...
[15:20:26] Starting 'build:demoapp'...
[15:20:26] Starting 'build:npm:statics'...
[15:20:26] Starting 'build:npm:package.json'...
[15:20:26] Starting 'build:npm:src'...
[15:20:26] Finished 'build:npm:package.json' after 66 ms
[15:20:27] Finished 'build:demoapp' after 670 ms
[15:20:27] Starting 'build:gh-pages'...
[15:20:27] Starting 'jsdoc:generate'...
The system cannot find the file specified.
[15:20:27] 'jsdoc:generate' errored after 59 ms
[15:20:27] Error: 1
    at formatError ([PATH]\braintree-web-drop-in\node_modules\gulp\bin\gulp.js:169:10)
    at Gulp.<anonymous> ([PATH]\braintree-web-drop-in\node_modules\gulp\bin\gulp.js:195:15)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone ([PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:264:8)
    at [PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:275:23
    at finish ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:29:3)
    at ChildProcess.<anonymous> ([PATH]\braintree-web-drop-in\gulpfile.js:204:7)
    at emitTwo (events.js:106:13)
[15:20:27] 'build' errored after 921 ms
[15:20:27] Error in plugin 'run-sequence(jsdoc:generate)'
Error
    at finish ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:56:13)
    at Gulp.onError ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:67:4)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone ([PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:264:8)
    at [PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:275:23
    at finish ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:29:3)
    at ChildProcess.<anonymous> ([PATH]\braintree-web-drop-in\gulpfile.js:204:7)
    at emitTwo (events.js:106:13)
[15:20:27] 'build:gh-pages' errored after 139 ms
[15:20:27] Error in plugin 'run-sequence(build)'
Error
    at finish ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:56:13)
    at Gulp.onError ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:67:4)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone ([PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:264:8)
    at [PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:275:23
    at finish ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:29:3)
    at finish ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:60:5)
    at Gulp.onError ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:67:4)
[15:20:27] 'build:gh-pages' errored after 203 ms
[15:20:27] Error in plugin 'run-sequence(jsdoc:generate)'
Error
    at finish ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:56:13)
    at Gulp.onError ([PATH]\braintree-web-drop-in\node_modules\run-sequence\index.js:67:4)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone ([PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:264:8)
    at [PATH]\braintree-web-drop-in\node_modules\orchestrator\index.js:275:23
    at finish ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb ([PATH]\braintree-web-drop-in\node_modules\orchestrator\lib\runTask.js:29:3)
    at ChildProcess.<anonymous> ([PATH]\braintree-web-drop-in\gulpfile.js:204:7)
    at emitTwo (events.js:106:13)

if I comment the following code in gulpfile.js:

gulp.task('jsdoc:generate', function (done) {
  jsdoc({
    configure: 'jsdoc/conf.json',
    destination: config.dist.jsdoc + VERSION,
    recurse: true,
    readme: config.jsdoc.readme,
    template: 'node_modules/jsdoc-template'
  }, done);
});

everything works fine.

Generic error NO_PAYMENT_METHOD_ERROR

The dropin returns always the error NO_PAYMENT_METHOD_ERROR for all failures regarding credit cards.
It could be useful to get "real errors" returned by the payment gateway (e.g., the gateway returns "Duplicate card exists in the vault" for duplicate credit cards).

Error paypal dropin

General information

Issue description

Screen: http://i.imgur.com/ef244va.png

When I click on 'Pay' on the 'Paypal' button I have a popup that opens and then closes directly with the errors displayed on the screenshot.

Code:
braintree.dropin.create({ authorization: 'token' selector: '#dropin-container', paypal: { amount: 10.00, currency: 'EUR' } }, 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 } console.log(payload); }); }); });

Thanks you !

"Choose another way to pay" unclickable after payment

General information

  • 1.3.1
  • Sandbox
  • Chrome 57.0.2987.98 (64-bit) and Firefox 53.0.2 (64-bit)

Issue description

As a user with already one saved credit card I want the page to reload after a payment goes through the server, regardless of success or failure, and to be able to make another payment using the drop-in UI. I want to be able to choose from the saved credit or 'choose another way to pay'.

After a payment goes through on the server the page refreshes. The user has a list of items that he can click pay on which will pop open a modal with the drop-in UI, and the majority of the time the "Choose another way to pay" link/button will not be clickable. I am assuming there is some sort of caching on braintree's side because the few times it works it is because the whole drop-in component reloads.

PayPal Vault Callback?

When adding a credit card, we bind the Submit button to requestPaymentMethod, which provides a callback to execute additional actions, after the credit card has been added.

When adding a PayPal account using the Vault workflow, it opens a popup window, which allows the user to login to his PayPal account and authorize it, after which, it closes the popup window and returns the user to the main window. I need to execute additional actions after this process completes, but I can't find any event or callback to hook into, that would execute when the PayPal authorization is complete. Am I missing something? If no such callback exists, would you consider adding one?

Provide better UX for unsupported browsers/Safari 6 support

General information

  • SDK/Library version: 1.0.2
  • Environment: Production
  • Browser and OS: Safari 6 on MacOS X 10.7

Issue description

A user on Safari 6 is trying to make a payment with the JS drop-in v3, and they're reporting it's not working. I attempted to reproduce this with BrowserStack, and confirmed that the drop-in seems to be broken and won't advance past the payment input screen.

My first question/issue would be: should Safari 6 work with the drop-in? In the developer console, I see a quickly increasing count of Blocked a frame with origin "https://www.paypal.com" from accessing a frame with origin "<site>" messages. There are also some rendering issues with the text and icons.

If not, I'd love to see the drop-in do a better job of detecting an unsupported browser and doing something smarter instead of just "hanging" and throwing a bunch of exceptions to the console. It might be better to just load up a "This is an unsupported browser" type message at the onset to avoid user frustration trying to use something that's never going to work.

Braintree option changed event

General information

Issue description

Hi,

I feel selecting a braintree option should also emit an event. I'm talking about these:
image

The only correct way to tie the drop-in into for example an AngularJS app is via events. Everything else means simply hacking your way around the limitations. And in my opinion the payment process shouldn't be a half-baked hacked up solution. It's great that the drop-in lib exists, but many apps nowadays are SPA's and these kind of events would be of great help.

Thanks!

TypeError

Uncaught TypeError: Cannot read property 'getConfiguration' of undefined
    at Object.r [as sendEvent] (dropin.min.js:formatted:3946)
    at n._initialize (dropin.min.js:formatted:3782)
    at dropin.min.js:formatted:3909
    at dropin.min.js:formatted:614
r @ dropin.min.js:formatted:3946
n._initialize @ dropin.min.js:formatted:3782
(anonymous) @ dropin.min.js:formatted:3909
(anonymous) @ dropin.min.js:formatted:614

Happens sometimes when I destroy and re-create the drop in.

Dynamic PP amount?

braintree.dropin.create({
            authorization: 'sandbox_XXX ',
            selector: '#braintree-dropin',
            paypal: {
                flow: 'checkout',
                amount : this.getMoney(), // <== THIS
                currency: 'EUR'
            }
        }

Is it possible to have the amount property dynamic? At the moment the amount value is bound on construct time, and since we cannot do byref assignment in JS, this is a problem.

I'm looking for a way to do something like braintree.paypal.amount = XYZ

At the moment, I am emptying the #braintree-dropin and re-creating it, but that's obviously shit then all CCs data are lost. So, for example, if someone changed his mind about how much they wanna spend/pay, and I reconstruct the dropin and the CC data are lost.

Missing translation and CSS bug

General information

  • SDK/Library version: 1.0.0 Beta 6
  • Environment: Sandbox
  • Browser and OS Chrome 57.0.2987.133 (64-bit)) on MacOS 10.12.4

Issue description

Screenshot:

screen shot 2017-04-24 at 10 47 10 am

Both issues are visible in the screenshot:

  • Translation is not correct. The DropIn-UI is set to de_DE (works fine for the other parts)
  • CSS is buggy. Element has a max-width of 148px, but the main container is larger by default

CCV absent

Hello,

thanks for this awesome work.
My integration works well with the sandbox but I wonder if I need to do something for the CCV as i want to charge people in france and it seems mandatory.
Any help appreciated.

Destroying and recreating the dropin

I think you guys should expose a drop-in API for destroying the thing, cause as it is, we have to do it ourselves and it can be a pain, since simply emptying the container will keep the event handler bound to the purchase button, meaning the requestPaymentMethod will be called multiple times.

This is how I used to do it (which was buggy since it would trigger the requestPaymentMethod multiple times upon re-creating it):

    createDropin : function() {
        var self = this;

        // Braintree
        var submitButton = document.querySelector('#braintree-submit-button');

        braintree.dropin.create({
            authorization: 'xxx', // @TODO change
            selector: '#braintree-dropin',
            paypal: {
                flow: 'checkout',
                amount : this.getMoney(),
                currency: 'EUR'
            }
        }, 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

                        //self.displayResponse(err, 'bg-danger');
                        return;
                    }

                    // Send payload.nonce to your server
                    self.sendPayload(payload);
                });
            });
        });
    },

    destroyDropin : function() {
        $('#braintree-dropin').empty();
    },

Now I do it like this, which works almost perfectly:


    _submitButton : null,
    _submitButtonEventCallback : null,

    createDropin : function() {
        var self = this;

        // Braintree
        self._submitButton = document.querySelector('#braintree-submit-button');

        var dropin = braintree.dropin.create({
            authorization: 'xxx', // @TODO change
            selector: '#braintree-dropin',
            paypal: {
                flow: 'checkout',
                amount : this.getMoney(),
                currency: 'EUR'
            }
        }, function (err, dropinInstance) {
            if (err) {
                // Handle any errors that might've occurred when creating Drop-in
                Rollbar.error("Braintree drop-in creation failed.", err);
                return;
            }

            self._submitButtonEventCallback = function() {
                dropinInstance.requestPaymentMethod(function (err, payload) {
                    if (err) {
                        Rollbar.info("Braintree error in requesting payment method.", err);

                        self.displayResponse(err, 'bg-danger');
                        return;
                    }

                    // Send payload.nonce to your server
                    self.sendPayload(payload);
                });
            };

            self._submitButton.addEventListener('click', self._submitButtonEventCallback);
        });
    },

    destroyDropin : function() {
        var self = this;
        $dropin = $('#braintree-dropin');

        self._submitButton.removeEventListener('click', self._submitButtonEventCallback);
        self._submitButtonEventCallback = null;

        $dropin.empty();
    },

What I'm doing is I'm using removeEventListener to get rid of the current click handler when destroying it.

Is this a good approach? Pls don't laugh at my JS, I'm a PHP guy :D

Container input support

I was skimming some of the source code in lieu of documentation (see #158), when I noticed this: https://github.com/braintree/braintree-web-drop-in/blob/182bd39/src/dropin.js#L47

  if (!this._merchantConfiguration.selector) {
    analytics.sendEvent(this._client, 'configuration-error');
    callback(new DropinError('options.selector is required.'));
    return;
  }

  container = document.querySelector(this._merchantConfiguration.selector);

In Braintree v2, directly passing in container with a DOM element was supported (and my existing code depends on this). Would you be willing to add that option back in this module?

There are inconsistencies between translations of string 'payingWith'

Issue description

The string payingWith is translated differently in various languages. For example, in en.js, it is simply "Paying with" whereas in it_IT.js is "Pagamento con {{paymentSource}}," but paymentSource is left unchanged.

Actually, the problem is in the translation itself, or in the fact that the string paymentSource is not replaced with a correct value.

JS Exception on IE9: SCRIPT438: Object doesn't support property or method 'setRequestHeader'

General information

  • SDK/Library version: 1.0.2
  • Environment: Production
  • Browser and OS: IE9 on Windows 7

Issue description

IE9 is throwing a script error when loading the drop-in.

SCRIPT438: Object doesn't support property or method 'setRequestHeader'

It may be harmless (drop-in still seems to work) but it would be better to gracefully handle this case instead of throwing an unhandled exception.

Repro

Open IE9 on Windows 7 (using browserstack.com or similar).
Navigate to: https://developers.braintreepayments.com/guides/drop-in/javascript/v3
Open the F12 developer tools and view the console.

Loading spinner is not centered

screen shot 2017-02-24 at 11 23 17

As you can see in the attached image the loading spinner is slightly misplaced. It's not a big deal, but still looks weird.

Tested on Chrome version 56.0.2924.87 (64-bit)

Web Drop-In Is Almost Suitable As Credit Card Management Page

The Web drop-in UI is so very close to being useable as a credit card management page. What I mean is that it is very useful even if you are not planning to capture the nonce and send it to the server.

The one functionality I am missing is having the option of adding a button underneath the payment method entry area that says "Add This Payment Method" (matching the "Choose Another Way to Pay" button) which only appears when adding a new payment method and causes the entered CC information to be validated, and if valid, saved. "Choose another way to pay" and this "Add this payment method" button would never be displayed at the same time.

For my app, the customer must set up a credit card prior to requesting services (in this particular case, we are driving people home who have been drinking and it's ideal to get CC info entered when sober.)

Delete Button

Could you add a Delete button, that would allow a user to delete an existing payment method?

Drop dependency on remote subresource

This module currently depends on loading its css remotely from https://assets.braintreegateway.com/web/dropin/1.0.2/css/dropin.css, which is blocked by our CSP and breaks the payment form UI.

We're able to temporarily work around this issue by directly including dropin.css in our project source, but it'd be preferable if dropin.css were included in the npm package and only downloaded from assets.braintreegateway.com at run-time if it couldn't be determined that the necessary styling had already been loaded.

Default Card Option not available

General information

  • SDK/Library version: 1.0.2
  • Environment: Sandbox
  • Browser and OS : Chrome and expo ios simulator

Issue description

using
braintree.dropin.create({
authorization: 'token',
selector: '#dropin-container',
paypal: {
flow: 'vault'
},
},function (createErr, instance) {

but only paypal shows up without the default card option. if I take paypal out, there will be no option displayed

I want both paypal and card options

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

Build Error on windows machines

Hi There,

Could you please help me what problem is? I can't build this.

C:\workspace\parmica_new\braintree-web-drop-in>npm run build

[email protected] build J:\workspace\parmica_new\braintree-web-drop-in
gulp build

[10:31:18] Using gulpfile J:\workspace\parmica_new\braintree-web-drop-in\gulpfile.js
[10:31:18] Starting 'build'...
[10:31:18] Starting 'clean'...
[10:31:18] Finished 'clean' after 4.39 ms
[10:31:18] Starting 'build:js:unmin'...
[10:31:18] Starting 'build:js:min'...
[10:31:18] Starting 'build:css'...
[10:31:18] Starting 'build:jsdoc'...
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn bash ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

npm ERR! Windows_NT 10.0.14393

Thanks,

Overflow on iPhone5 inside Bootstrap modal

General information

  • SDK/Library version: 1.0 beta4
  • Environment: sandbox
  • Browser and OS: Chrome 56.0.2924.87 (64-bit) on MacOS 10.12.3

Issue description

screen shot 2017-03-04 at 13 43 46

This is how I've fixed it:


/* BRAINTREE FIX on small phones */
@media (max-width: 320px) {
    .braintree-option {
        width: 83vw;
    }
}
@media (min-width: 321px) {
    .braintree-option {
        width: 100%;
    }
}
/* ENDS BRAINTREE FIX */

paymentMethodRequestable Triggering Prematurely

I implemented the new paymentMethodRequestable event on my form. It works perfectly when adding a PayPal account. However, when adding a credit card, if you have the zip code field enabled, the event triggers when the user enters the third digit of his zip code. This is incorrect since the credit card is not requestable until after the user clicks the Submit button.

In my case, I'm using the event to retrieve the list of payment methods and update a dropdown with the available methods. Since the event triggers before the credit card has been added, the dropdown updates prematurely and the new credit card does not show up until after the page has been refreshed.

Selected method changed event? paymentMethodRequestable inconsistency

General information

Issue description

Hi all,

I feel that having paymentMethodRequestable and noPaymentMethodRequestable is not really enough to get a flawless workflow with the drop-in. Let's take these few images as an example of what I'm thinking of:

Step 1.

  • user enters the details of a card he wants to use
  • paymentMethodRequestable fired, it's now safe for the user to click the "Select payment method" button so we unhide it
  • the user clicks the button button which calls dropInInstance.requestPaymentMethod()
  • we obtain the nonce, hide the "Select payment method" button, the drop-in changes to "Paying with card" view and we display the "Pay" button - Step 2.
  • if the user clicks the "Pay" button, we make a request to the back-end which then creates a transaction
  • all fine so far

payment - quickdbd - google chrome

Step 2.

  • the user changes his mind, and clicks the "Choose another way to pay" button
  • at this point noPaymentMethodRequestable event has fired
  • we hide both the "Select payment" and "Pay" button because it makes sense to do so
  • the user is taken to Step 3.

payment - quickdbd - google chrome_2

Step 3.

  • this is where the inconsistency lies and where I feel the problem is

Step 3.1.

  • if we click on the top button (original card details ending with 11), paymentMethodRequestable is fired but the drop-in also automatically takes you back to the Step 2., only this time with the wrong button being displayed ("Select payment method")
  • this time we don't have to click that button because the drop-in is already aware of the current nonce, our app has it cached in current controller instance and making an additional request in unnecessary
  • having to click this button one more time is redundant and brings a bit of confusion to the UX
  • instead, we want to display the "Pay" button

Step 3.2.

  • if we enter new card details the paymentMethodRequestable fires after the last detail is entered
  • now we can display the "Select payment method" button which in this case is correct
  • we click the button, it calls the dropInInstance.requestPaymentMethod(), gets the new nonce and the user gets taken to Step 2.
  • this time the correct button is displayed ("Pay")

payment - quickdbd - google chrome_3

To me it seems that with the current combinations of events which the drop-in lib provides, it's impossible to get the workflow to avoid that redundant "Select payment method" click. Am I right or is there perhaps a way to do it and I'm totally clueless? Is there a way to know whether the paymentMethodRequestable came from clicking on an existing payment method or from filling the form with the last bit of information?

I believe the needed information (origin of event) could be put inside the even param of the paymentMethodRequestable event callback. That would make these two events distinguishable and it would help a lot.

Thanks!

Error in ru_RU.js translations

Issue description

Error in file /src/translations/ru_RU.js.
Please change {{LastTwoCardDigits}} to {{lastTwoCardDigits}}.

Test Credit Card number gets accepted in production

General information

  • SDK/Library version: dropin/1.0.0-beta.4/js/dropin.min.js
  • Environment: Production
  • Browser and OS Chrome 56.0.2924.87 (64-bit) on MacOS 10.12.3

Issue description

As a user I enter test Visa credit card data (4111 1111 1111 1111) into the fields provided by drop-in UI.

Observed behaviour

UI accepts given credit card and animates into the "OK check in a circle" state.

Expected behaviour

Drop-in UI shall show an error saying that the entered credit card is not valid when running in Production environment.

Expiration Date Box Offset

General information

  • SDK/Library version: DropIn UI 1.0.0-beta.5 with SDK v3
  • Environment: Sandbox
  • Browser and OS: Chrome (multiple version) on MacOS 10.12.4

Issue description

Expiration Date Box is offset:
offset expiration date

The dropinui is compiled into a large external.js file for our app and we also have various css. Not sure what other detail is needed.

Thanks!

The current version of drop-in hangs at loading

General information

  • SDK/Library version: unreleased (according to changelog)
  • Environment: Sandbox (I have not tested it on production)
  • Chrome 57.0.2987.133, Firefox 52.0.2 (32 bit), IE 11 on Windows 8.1 (64bit)

Issue description

The dropb-in hangs at "loading" showing the loading throbber indefinitely.

I'm using the initialization 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) {
					console.log(err);

					return;
				}

				alert(payload);
			});
		});
	});
</script>

I have tried the cases:

1. [CLIENT_AUTHORIZATION]=Braintree_ClientToken::generate()
2. [CLIENT_AUTHORIZATION]=Braintree_ClientToken::generate(array(
			'customerId' => $customer_id,
			'options'    => array(
				'verifyCard'                   => true,
				'failOnDuplicatePaymentMethod' => true
			)
		));

Please note that the previous version works correctly (with the same settings).

Minified Dropin Breaks

General information

SDK/Library version: DropIn UI 1.0.0-beta.5 with SDK v3
Environment: Sandbox/Prod
Browser and OS: Chrome (multiple version) on MacOS 10.12.4

Issue description

Everything works fine when gulp does not minify our compiled JS. But once minified, it no longer attaches to the div and gives no errors in console.

Form-fill with LastPass results in incomplete CC#

General information

  • SDK/Library version: 1.0.2
  • Environment: Production
  • Browser and OS: Chrome 58 on Windows 10

Issue description

A user has reported this issue, which I have been able to verify.

  1. Setup the LastPass browser plugin.
  2. Add a Form Fill profile with a credit card. Ensure the credit card number does not have spaces in it when entered into LastPass, e.g. 4111111111111111.
  3. Navigate to a page with the drop-in UI.
  4. Initiate the form fill with LastPass using the previously added card profile.

actual
The filled in credit card number is missing the last 3 digits:

image

expected
The filled in credit card will contain the complete credit card number.

Note: this only seems to repro with LastPass, and not if you paste in a credit card number manually. There must be some issue with the form validation and how LastPass enters the info.

Update Version to 3.8.0 Compatability

Hi Braintree,

The current version of the beta seems to only support version 3.7.0 when using the DropinInstance._client object to create a DataCollector. In order to generate device data using version 3.8.0 of the DataCollector, I believe the checks for version 3.7.0 will need to be updated to 3.8.0.

I updated my local copy of the dropin beta js file to check for version 3.8.0 and that appears to have resolved the issue should I choose to serve the js file from my own server.

Kind Regards,

"Choose another way to pay" option

Guys, after adding a credit card there is an option "Choose another way to pay" popping up in the UI. Is it possible to somehow avoid it? Thanks!

TypeScript type definition

A type definition for this to go along with @types/braintree would be really helpful (or have @types/braintree extended to cover braintree.dropin). Glad to see that this is finally supported with the v3 SDK!

Issue in main.scss

Please note that at line 517 of main.scss:

transition: font-weight 300;

there is an error.

v1.0.0 paypal payment method fails on sandbox

General information

  • SDK/Library version: drop-in web v1.0.0
  • Environment: sandbox
  • Browser and OS: Chrome 58.0.3029.96 (64-bit) on MacOS Sierra -->

Issue description

After configuring the "final" release of the drop-in (v1.0.0) in a staging enviroment with the sandbox the comunication with paypal fails.

captura de pantalla 2017-05-05 a las 17 58 50

BTW, the credit card payment method works fine.

Hitting Enter/Return Key while focus is on Credit Card CVV/Expiration Date/ZIP fields clears existing input and makes them uneditable

General information

  • SDK/Library version: 1.3.0
  • Environment: Sanbox & Production
  • Browser and OS : Chrome58.0.3029.110 (64-bit) on MacOS 10.12.4

Issue description

You can test this out by generating a Credit Card Form and hitting Return key when one of these fields are focused. (Expiration Code/CVV/Postal Code).

I did not get to check what's causing the issue, but can confirm this is not happening on older versions.

Linking a fiddle if anyone wants to try it out quick.
https://jsfiddle.net/ww7c27xv/show/

Focus your pointer on Expiration Date, Hit Return Key and try to enter anything in the same field.

Error attempting to add PayPal payment to vault.

General information

  • 1.3.1
  • Environment: Sandbox
  • Chrome 59.0.3071.109 on Mac OS 10.10.5

Issue description

I'm attempting to add PayPal payment methods to the Braintree vault via the Drop-In UI.

I've followed the steps to link my Braintree sandbox to my PayPal sandbox as outlined here.

Included in the options I have for the Drop-In create method is:

paypal: { flow: 'vault' }

The drop-in UI is rendering OK in my browser.

But when I click the PayPal Checkout button the PayPal pop-up window appears momentarily then closes itself. I then I have a error in my browser console that says Error: Error: No value passed to payment, and the drop-in UI displays a message around the PayPal Checkout button saying Something went wrong on our end.

If I change the the create options to use the checkout flow the PayPal pop-up window opens OK and I don't get the error. ie:

paypal: {
  flow: 'vault',
  amount: '10.00',
  currency: 'USD'
}

But (obviously) this is not what I want because I want to vault the PayPal payment method.

Using the Drop-In UI to add credit card payment methods to the vault works OK.

Could this be an issue with the linked Braintree and PayPal sandboxes?

The Braintree web console gives no indication that the details I've entered are actually correct (I think they are, but if I add total nonsense I receive no error back from the web console).

beta-6 to beta-7 migration

Hey, is there anything I should know when it comes to latest beta migration? I checkout your releases, but there are no release notes.

What's changed? Any BC breaks?

I'm using this in production.

Thank you

PayPal sandbox: "PayPal pending payments are not supported"

So, I migrated from beta-6 to 1.0.1, and I had to go the through the incoherent and very annoying process of linking PayPal sandbox account.

So, in the essence, I've linked my facilitator account to braintree sandbox, and tried to pay through my PP buyer sandbox account, but after logging in... well this is annoying even to describe, so here's a video: https://drive.google.com/open?id=0B7AKQvQJ6zw2Q0NzR0Zya0F0eWs

i liked the simplicity of using PP sandbox previously, this is just pure AIDS.
also, PP loading is very slow (are you using CDNs? I'm in Amsterdam)

How to create a reccurring billing with drop in UI

Server-side is .NET.
Client-side is the browser.

I'd like to create a recurring subscription payment as easily as possible with the least amount of code. How do I go about this with the drop-in UI for a completely new customer?

As far as I understand, at a high-level:

  • I need to create a "subscription" plan. Great, did it via Control Panel. โœ… Easy.
  • Next, I need to vault the "customer info" first. IE: First Name, Last Name whatever.
    • Okay, so, does drop-in UI v3 support this? Are there examples for capturing this information?
    • If not, does drop-in UI v2 support this? Are there any examples? Can't seem to find any UI that supports capturing "customer" info on this page.
  • Then vault the payment CCard info.
    • Does drop-in UI v3 support this? (I think the obvious answer is yes here)
    • Do I need the .NET SDK to generate a "client token" to associate the vaulted customer and their payment info?

Also, looks like PayPal Payment Method can do 'recurring billing' too:-1: This stinks, I hate PayPal's dumpster-fire APIs. If I wanted PayPal I would have used their SDK. /endrant. Anywho, even more, unanswered questions:

  • Does this PayPal "vault" flow support capturing "customer" info in step 1 (or maybe I don't even need step 1)?
  • Do my special credit card processing rates I have with Braintree apply with this PayPal checkout vault flow? Or will I get charged "Paypal's 2.9%+30c" standard rates?
  • Can I use this PayPal "vault" flow without burdening the user with shipping address info?

General information

  • SDK/Library version: .NET and JavaScript SDK

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.