How to use the tipsi-stripe.createTokenWithCard function in tipsi-stripe

To help you get started, we’ve selected a few tipsi-stripe 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 Weakky / prisma-ecommerce / mobile / src / views / payment / Payment.js View on Github external
handleCardPayPress = async () => {
    try {
      this.setState({ loading: true, token: null });
      const token = await stripe.createTokenWithCard({
        number: this.state.card.number,
        expMonth: this.state.card.expMonth,
        expYear: this.state.card.expYear,
        cvc: this.state.card.cvc,
      });

      const { data } = await this.props.pay({
        stripeTokenId: token.tokenId,
      });

      const payPayload = data.pay;

      // If payment was instantly chargeable
      if (!payPayload.redirectUrl && payPayload.order.orderStatus === 'PAID') {
        return this.setState({
          loading: false,
github artsy / emission / src / lib / Components / Bidding / Screens / CreditCardForm.tsx View on Github external
tokenizeCardAndSubmit = async () => {
    this.setState({ isLoading: true, isError: false })

    const { params } = this.state

    try {
      const token = await stripe.createTokenWithCard({ ...params })
      this.props.onSubmit(token, this.state.params)
      this.setState({ isLoading: false })
      this.props.navigator.pop()
    } catch (error) {
      console.error("CreditCardForm.tsx", error)
      this.setState({ isError: true, isLoading: false })
    }
  }
github artsy / emission / src / lib / Components / Bidding / Screens / ConfirmFirstTimeBid.tsx View on Github external
async registerAndPlaceBid() {
    this.setState({ isLoading: true })

    const { billingAddress, creditCardFormParams } = this.state
    const token = await stripe.createTokenWithCard({
      ...creditCardFormParams,
      name: billingAddress.fullName,
      addressLine1: billingAddress.addressLine1,
      addressLine2: null,
      addressCity: billingAddress.city,
      addressState: billingAddress.state,
      addressZip: billingAddress.postalCode,
    })

    commitMutation(this.props.relay.environment, {
      onCompleted: () => this.createBidderPosition(),
      onError: e => console.error(e, e.message),
      mutation: creditCardMutation,
      variables: {
        input: {
          token: token.tokenId,
github artsy / emission / src / lib / Components / Bidding / Screens / Registration.tsx View on Github external
async createTokenFromAddress() {
    const { billingAddress, creditCardFormParams } = this.state
    return stripe.createTokenWithCard({
      ...creditCardFormParams,
      name: billingAddress.fullName,
      addressLine1: billingAddress.addressLine1,
      addressLine2: billingAddress.addressLine2,
      addressCity: billingAddress.city,
      addressState: billingAddress.state,
      addressZip: billingAddress.postalCode,
      addressCountry: billingAddress.country.shortName,
    })
  }
github artsy / emission / src / lib / Components / Bidding / Screens / ConfirmBid / index.tsx View on Github external
async createTokenFromAddress() {
    const { billingAddress, creditCardFormParams } = this.state

    return stripe.createTokenWithCard({
      ...creditCardFormParams,
      name: billingAddress.fullName,
      addressLine1: billingAddress.addressLine1,
      addressLine2: billingAddress.addressLine2,
      addressCity: billingAddress.city,
      addressState: billingAddress.state,
      addressZip: billingAddress.postalCode,
      addressCountry: billingAddress.country.shortName,
    })
  }
github tipsi / tipsi-stripe / example / src / scenes / CustomCardScreen.js View on Github external
handleCustomPayPress = async (shouldPass = true) => {
    try {
      this.setState({ loading: true, token: null, error: null })

      const params = shouldPass ? this.state.params : this.state.errorParams
      const token = await stripe.createTokenWithCard(params)
      this.setState({ loading: false, error: undefined, token })
    } catch (error) {
      this.setState({ loading: false, error })
    }
  }