Neurological Phenomenon Multiplexer

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

react-native-webview-braintree

0.0.5 • Public • Published

React Native Webview Braintree

A Braintree payment component with no native code for React Native apps.

npm npm npm npm

Usage

<WebViewBraintree
    clientToken={this.state.clientToken}
    nonceObtainedCallback={this.handlePaymentMethod}
    navigationBackCallback={this.navigationBackCallback}
    paymentAPIResponse={this.state.paymentAPIResponse}
/>	

This component accepts the following props

  • clientToken
  • nonceObtainedCallback
  • navigationBackCallback
  • paymentAPIResponse
Name Required Description
clientToken yes Braintree client token used to create the dropin UI
nonceObtainedCallback yes Function called once a Braintree payment nonce is obtained, the nonce value is passed to ehe function as the only parameter
paymentAPIResponse yes A string indicated the success of the an API to Braintree transaction API. The string should be either "PAYMENT_SUCCESS" "PAYMENT_REJECTED"
navigationBackCallback no Function that can be called in order to initiate navigation. This function will be called when the user clicks on a button labeled "Return to Shop" that appears after a rejected or successful purchase

Example use of the paymentAPIResponse string

brainTreeUtils
    .postPurchase(nonce, this.props.cart.totalPrice, {})
    .then(response => {
        if (response.type === "success") {
            this.setState({ paymentAPIResponse: "PAYMENT_SUCCESS" });
            this.props.dispatch(actions.cartActions.emptyCart());
        } else {
            this.setState({ paymentAPIResponse: "PAYMENT_REJECTED" });
        }
});

Example Application

React Native Webview Braintree test application

TODOs

Integrate Paypal payments

LICENSE

MIT

install

npm i react-native-webview-braintree

Downloadsweekly downloads

37

version

0.0.5

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability