How to use react-stripe-elements - 10 common examples

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webkom / lego-webapp / app / routes / events / components / StripeElement.js View on Github external
currency="NOK"
            allowRememberMe
            locale="no"
            token={onToken}
            stripeKey={config.stripeKey}
            amount={event.price}
            email={currentUser.email}
          >
            <button style="{{">Betal nå</button>
          
        )}
      
    );
  }
}
const InjectedForm = injectStripe(PaymentRequestForm);

// TODO Move this to a "global" thing
const WithProvider = (props: Props) =&gt; (
  
    
      
    
  
);
export default WithProvider;
github Automattic / wp-calypso / client / lib / stripe / index.js View on Github external
useEffect( () =&gt; {
		debug( 'loading stripe configuration' );
		let isSubscribed = true;
		getStripeConfiguration( requestArgs || {} ).then(
			configuration =&gt; isSubscribed &amp;&amp; setStripeConfiguration( configuration )
		);
		return () =&gt; ( isSubscribed = false );
	}, [ requestArgs, stripeError ] );
	return { stripeConfiguration, setStripeError };
}

function StripeHookProviderInnerWrapper( { stripe, stripeData, children } ) {
	const updatedStripeData = { ...stripeData, stripe };
	return { children };
}
const StripeInjectedWrapper = injectStripe( StripeHookProviderInnerWrapper );

export function StripeHookProvider( { children, configurationArgs } ) {
	debug( 'rendering StripeHookProvider' );
	const { stripeConfiguration, setStripeError } = useStripeConfiguration( configurationArgs );
	const { stripeJs, isStripeLoading, stripeLoadingError } = useStripeJs( stripeConfiguration );

	const stripeData = {
		stripe: null, // This must be set inside the injected component
		stripeConfiguration,
		isStripeLoading,
		stripeLoadingError,
		setStripeError,
	};

	return (
github kube-js / kube-ts-react-client / src / components / PaymentForm / index.tsx View on Github external
type="submit"
              fullWidth
              variant="contained"
              color="secondary"
              size="large"
            &gt;
              {t('checkout.buyNow')}
            
          
        
      
    
  );
};
// tslint:disable-next-line:max-file-line-count
export default injectStripe(PaymentForm);
github OriginProtocol / origin / dapps / shop / src / pages / checkout / ChoosePayment.js View on Github external
import addData from 'data/addData'

import WalletStatus from 'queries/WalletStatus'
import MakeOffer from 'mutations/MakeOffer'
import AllowToken from 'mutations/AllowToken'

import Price from 'components/Price'
import Link from 'components/Link'
import WithPrices from 'components/WithPrices'

import CryptoWallet from './CryptoWallet'
import WaitForTransaction from '../../components/WaitForTransaction'

const MarketplaceContract = process.env.MARKETPLACE_CONTRACT

const CreditCardForm = injectStripe(({ stripe }) => {
  // const [paymentMethod, setPaymentMethod] = useState()
  // const [applePay, setApplePay] = useState(false)

  const { config } = useConfig()
  const [token, setToken] = useState('token-ETH')
  const [tokenStatus, setTokenStatus] = useState({})
  const [formData, setFormData] = useState({})
  const [loading, setLoading] = useState(false)
  const [paymentReq, setPaymentReq] = useState()
  const [{ cart }, dispatch] = useStateValue()
  const [approveOfferTx, setApproveOfferTx] = useState()
  const [auth, setAuth] = useState()
  const [offerTx, setOfferTx] = useState()
  const history = useHistory()
  const paymentMethod = get(cart, 'paymentMethod.id')
github beachio / chisel / src / containers / MainArea / PaymentMethods / PaymentMethods.js View on Github external
type="submit"
                         disabled={!this.state.complete || this.state.errorRequired}
                         value={payPlan ? "Subscribe" : "Add Method"} /&gt;
        
        {this.state.error &amp;&amp;
          <div>{this.state.error}</div>
        }
        {this.state.errorRequired &amp;&amp;
          <div>All fields are required to fill!</div>
        }
      
    );
  }
}

export const PayCardElement = injectStripe(_PayCardElement);


@CSSModules(styles, {allowMultiple: true})
class PaymentMethods extends Component {
  state = {
    method: null,
    pending: false,
    defaultMethod: true
  };
  
  methods = [];
  payPlan = null;
  isYearly = false;
  
  
  constructor(props) {
github opencollective / opencollective-frontend / components / NewCreditCardForm.js View on Github external
{hasSaveCheckBox &amp;&amp; (
          
            
          
        )}
      
    );
  }
}

const NewCreditCardFormWithStripe = injectStripe(NewCreditCardFormWithoutStripe);

const NewCreditCardForm = props =&gt; (
  
    
  
);

NewCreditCardForm.propTypes = {
  intl: PropTypes.object,
};

export default injectIntl(NewCreditCardForm);
github Automattic / wp-calypso / packages / composite-checkout / src / lib / stripe.js View on Github external
const [ currentAttempt, setAttempt ] = useState( 1 );
	const stripeConfiguration = useSelect( select =&gt; select( 'stripe' ).getStripeConfiguration() );
	const { getConfiguration } = useDispatch( 'stripe' );
	const getConfigurationMemo = useCallback( getConfiguration, [ currentAttempt, requestArgs ] );
	useEffect( () =&gt; {
		getConfigurationMemo( requestArgs );
	}, [ requestArgs, currentAttempt, getConfigurationMemo ] );
	const forceReload = () =&gt; setAttempt( currentAttempt + 1 );
	return { stripeConfiguration, forceReload };
}

function StripeHookProviderInnerWrapper( { stripe, stripeData, children } ) {
	const updatedStripeData = { ...stripeData, stripe };
	return { children };
}
const StripeInjectedWrapper = injectStripe( StripeHookProviderInnerWrapper );

/**
 * Custom Provider to access Stripe.js
 *
 * First you must wrap a parent component in this Provider. Then you can call
 * `useStripe()` in any sub-component to get access to the stripe variables and
 * functions. See `useStripe` for more details.
 *
 * This has one optional prop, `configurationArgs`, which is an object that
 * will be used when fetching the stripe configuration.
 *
 * @returns {object} React element
 */
export function StripeHookProvider( { children, configurationArgs } ) {
	const { stripeConfiguration, forceReload } = useStripeConfiguration( configurationArgs );
	const { stripeJs, isStripeLoading, stripeLoadingError } = useStripeJs( stripeConfiguration );
github unlock-protocol / unlock / unlock-app / src / components / interface / user-account / PaymentDetails.tsx View on Github external
Expiry Date
              
            
            <div>
              CVC Number
              
            </div>
          
        
        {this.submitButton()}
      
    )
  }
}

const InjectedForm = injectStripe(PaymentForm)

const mapDispatchToProps = (dispatch: any) =&gt; ({
  signPaymentData: (stripeTokenId: string) =&gt;
    dispatch(signPaymentData(stripeTokenId)),
  close: (e: WarningError) =&gt; {
    dispatch(resetError(e))
  },
})

interface ReduxState {
  account?: Account
  errors: UnlockError[]
}

const mapStateToProps = ({ account, errors }: ReduxState) =&gt; {
  const storageWarnings = errors.filter(
github artsy / reaction / src / Components / Payment / PaymentForm.tsx View on Github external
updater: (store, data) => this.onCreditCardAdded(me, store, data),
      }
    )
  }

  private onMutationError(errors, errorModalMessage?) {
    logger.error(errors)
    this.setState({
      isCommittingMutation: false,
      isErrorModalOpen: true,
      errorModalMessage,
    })
  }
}

export default injectStripe(PaymentForm)

react-stripe-elements

React components for Stripe.js and Stripe Elements

MIT
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis

Popular react-stripe-elements functions

Similar packages