How to use the braintree-web-drop-in.create function in braintree-web-drop-in

To help you get started, we’ve selected a few braintree-web-drop-in examples, based on popular ways it is used in public projects.

github adobe / aem-core-cif-components / react-components / src / components / App / paymentProviders / braintree.js View on Github external
required: true
                    },
                    overrides: {
                        fields: {
                            number: {
                                maskInput: {
                                    // Only show last four digits on blur.
                                    showLastFour: true
                                }
                            }
                        }
                    }
                };
            }

            const braintreeDropIn = await dropIn.create({
                authorization: braintreeToken,
                container: `#${CONTAINER_ID}`,
                paypal,
                card
            });

            braintreeDropIn.on('paymentMethodRequestable', () => {
                setPaymentMethodRequestable(true);
            });

            braintreeDropIn.on('noPaymentMethodRequestable', () => {
                setPaymentMethodRequestable(false);
            });

            setDropinInstance(braintreeDropIn);
        } catch (error) {
github Cretezy / braintree-web-drop-in-react / src / index.spec.js View on Github external
it("Calls teardown on destruction", done => {
		const braintreeWebDropIn = require("braintree-web-drop-in");
		const teardownMock = jest.genMockFunction();
		braintreeWebDropIn.create = () =>
			new Promise(resolve => {
				resolve({ teardown: teardownMock });
			});

		const component = renderer.create(
			<DropIn
				options={{ authorization: "bogus" }}
				onInstance={() => {
					component.unmount();
					const callNumber = teardownMock.mock.calls.length;
					expect(callNumber).toEqual(1);
					done();
				}}
			/>
		);
	});
github fluidtrends / carmel / chunks / payments / screens / checkout.web.js View on Github external
if (!response || !response.data || !response.data.clientToken) {
      this.props.getToken()
      return
    }

    const clientToken = response.data.clientToken
    const carmel1K = response.data.Carmel1K

    if (carmel1K.item.id !== Carmel1K.item.id ||
       carmel1K.item.price !== Carmel1K.item.price) {
       this.triggerRedirect("/pricing")
       return
    }

    dropin.create({
      authorization: clientToken,
      container: '#dropin-container'
    }, (createErr, clientService)  => {
      this.setState({ clientToken,  clientService })
    })
  }
github mutebg / online-store / src / components / checkout / index.js View on Github external
getToken().then(({ token }) => {
			let form = document.querySelector('#bakset-form');

			dropin.create(
				{
					authorization: token,
					container: '#dropin-container'
				},
				(createErr, instance) => {
					this.setState({
						isLoading: false
					});

					form.addEventListener('submit', e => {
						e.preventDefault();
						const data = getFormData(form).reduce((prev, next) => {
							prev[next[0]] = next[1];
							return prev;
						}, {});
github Cretezy / braintree-web-drop-in-react / src / index.js View on Github external
async componentDidMount() {
    this.instance = await BraintreeWebDropIn.create({
      container: ReactDOM.findDOMNode(this.wrapper),
      preselectVaultedPaymentMethod: this.props.preselectVaultedPaymentMethod,
      ...this.props.options
    });

    if (this.props.onNoPaymentMethodRequestable) {
      this.instance.on(
        "noPaymentMethodRequestable",
        this.props.onNoPaymentMethodRequestable
      );
    }
    if (this.props.onPaymentMethodRequestable) {
      this.instance.on(
        "paymentMethodRequestable",
        this.props.onPaymentMethodRequestable
      );

braintree-web-drop-in

[![Build Status](https://github.com/braintree/braintree-web-drop-in/workflows/Unit%20Tests/badge.svg)](https://github.com/braintree/braintree-web-drop-in/actions?query=workflow%3A%22Unit+Tests%22) [![Build Status](https://github.com/braintree/braintree-we

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis

Popular braintree-web-drop-in functions

Similar packages