logo
down
shadow

Stripe form not creating token


Stripe form not creating token

By : Blues
Date : November 22 2020, 11:12 AM
should help you out Read all the docs, multiple Stripe examples, and done the SO rounds. , The problem was my public key didn't have quotes around it.
code :
Stripe.setPublishableKey(<%= STRIPE_PUBLIC_KEY %>);
Stripe.setPublishableKey('<%= STRIPE_PUBLIC_KEY %>');


Share : facebook icon twitter icon
Creating stripe payment token after validating other fields

Creating stripe payment token after validating other fields


By : kvk
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , To keep this simple I have only included one of the forms I am validating. Everything validates right, but I can't figure out why a token does not get generated. The form never submits. I had the form working right without validating not sure what the problem is. , Figured it out. Needed to not have the submit function as a method.
code :
$('#payment-form').submit(function(event){
    // validate fields
    oeValidate.errors = false;
    oeValidate.name();

    // send the card details to Stripe
    if(!oeValidate.errors){
        // disable the submit button to prevent repeated clicks
        $('#stripe-submit').attr("disabled", "disabled");

        Stripe.createToken({
            name: $('#name').val(),
            number: $('#card-number').val(),
            exp_month: $('select[name="card-month"]').val(),
            exp_year: $('select[name="card-year"]').val(),
            cvc: $('#card-cvc').val()
        }, stripeResponseHandler);
    }

    // prevent the form from submitting the default action
    return false;
});
Creating Stripe customer from Stripe Token using .Net client library & Stripe.js

Creating Stripe customer from Stripe Token using .Net client library & Stripe.js


By : Zipo
Date : March 29 2020, 07:55 AM
it helps some times You can construct a CreditCardToken from a token ID (see here: https://github.com/nberardi/stripe-dotnet/blob/master/src/CreditCardToken.cs#L8).
As CreditCardToken implements ICreditCard, you can then use it as the card parameter in the CreateCustomer() method.
Creating stripe token using separate elements

Creating stripe token using separate elements


By : jaen maikel Bermudez
Date : March 29 2020, 07:55 AM
may help you . Instead of using the element type 'card' I needed to separate the elements, In the documentation example they only use 'card' so when they create a token they just pass the card object to the create token parameter. , From the Elements reference.
code :
var elements = stripe.elements();
var cardNumber = elements.create('cardNumber');
cardNumber.mount('#card-number');
var cardExpiry = elements.create('cardExpiry');
cardExpiry.mount('#card-expiry');
var cardCvc = elements.create('cardCvc');
cardCvc.mount('#card-cvc');

// creating a postal code element is deprecated 
// var cardPostalCode = elements.create('postalCode');
// cardPostalCode.mount('#card-postal-code');
stripe.createToken(cardNumber).then(doSomething);
// <input id="postal-code" name="postal_code" class="field" placeholder="90210" />

var cardData = { 
  address_zip: document.getElementById('postal-code').value
}

stripe.createToken(cardNumber,cardData).then(doSomething);
react-stripe-elements Error: You must provide a Stripe Element or a valid token type to create a Token

react-stripe-elements Error: You must provide a Stripe Element or a valid token type to create a Token


By : tudolgom
Date : March 29 2020, 07:55 AM
may help you . It turns out I never managed to solve the issue using react-stripe-elements. I ended using the standard JS version (from the stripe documentation). Here is my current working solution:
code :
import React from 'react';

class CheckoutForm extends React.Component {
  constructor(props) {
    super(props);
    this.handleSubmit = this.handleSubmit.bind(this);

    this.state = {
      elements: null,
      card: null
    };
  }

  componentWillReceiveProps() {
    this.setState({ elements: this.props.stripe.elements() }, () => {
      this.setState({ card: this.state.elements.create('card') }, () => {
        this.state.card.mount('#card-element');
      });
    });
  }

  handleSubmit(ev) {
    ev.preventDefault();
    this.props.stripe.createToken(this.state.card).then((token) => {
      console.log('Received Stripe token:', token);
    });
  }

  render() {
    return (
      <form onSubmit={this.handleSubmit}>
        <div className="row">
          <label >
            Credit or debit card
          </label>
          <div id="card-element"/>
          <div id="card-errors" role="alert"/>
        </div>
        <button>Submit Payment</button>
      </form>
    );
  }
}

class App extends React.Component {
  constructor() {
    super();
    this.state = {stripe: window.Stripe('test_key')};
  }

  render() {
    return (
      <CheckoutForm stripe={this.state.stripe}/>
    );
  }
}

export default App;
stripe creating token with card id

stripe creating token with card id


By : John Bates
Date : March 29 2020, 07:55 AM
This might help you You can not create a new token for an existing card as this would not make sense. The card is already saved on the customer and you can charge it.
The easiest solution here is likely to do the reverse and save the card on a customer when you get a token tok_XXXX. This way, you always charge a card by passing the customer parameter as the customer id cus_XXXX and the source parameter as the card id card_XXXX.
Related Posts Related Posts :
  • How do I perform a validation check to a text input using JavaScript?
  • div.style.display not working when declared inside a function
  • show Tooltip only when the ellipsis is active
  • Why my code with switch(true) and Array.concat() doesn't work properly
  • mouseleave() not deleting class
  • Cannot add class to clicked element
  • console.log show empty module
  • Is there a way to select any type of text?
  • How do I loop through multiple pages in an API?
  • Angular with ngrx - nothig happen
  • JS Map from Object.entries memory usage
  • React-Vis Legend toggle filter for line chart
  • how to set a component in react-modal?
  • How to create semicolon separated CSV in Javascript with custom file name?
  • Adding types to a recursive function
  • JavaScript: Match any element within array and return the match
  • scrollTop or scrollLeft on horizontal website?
  • Build error while creating wrapper for C++ to javascript using swig
  • ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10):
  • jQuery Script is not working after Pagination
  • Props from contextual provider: Property 'xxx' does not exist on type 'IntrinsicAttributes & InterfaceProps'
  • Setting state of an object property inside array of objects based on a computation after match : reactjs
  • Return data from joined table in Knex update
  • Why does this D3 code not produce any output in Jupyter Notebook?
  • Can't retreive my movies data after importing array function in React JS
  • Having issue with using jQuery pushy js in two menus
  • How do I scale an entire webpage for tablet screen width on load with javascript?
  • create .json file on run time in javascript and save it in the end
  • Weird error TypeError: Cannot read property 'getValue' of null
  • How to switch to a different date format?
  • Get notified when React tree is updated
  • Transform an object with an array into an array
  • How to format a Date in Javascript
  • How to apply mixpanel on event 'triggering' of dropdown in antdesign
  • Webpack bundle my js but that js wont work
  • Piping inside a subscribe in ngrx
  • Not recognized javascript function in html
  • Not able to get form element's value after submitting form using this.form.submit();
  • How to create binary to decimal in JavaScript without parseInt()
  • How to change cell background color and add text(from selected button) in full calendar Cell by Clicking Button?
  • How to flatten array with the given callback in Javascript?
  • Pulling Data off a Weather API and tweeting it
  • How to change Header in fetch request at no-cors?
  • When a button is clicked that decrements a value, how do you stop it decrementing into the negative range
  • How do I call another method from within the same class in Javascript
  • Is it possible to sort a ES6 map object for a property of its value object?
  • Unable to create a new project with the Nest CLI
  • Remove childless elements (except leafs) from nested array
  • JS: Call certain function before calling each of other functions in file
  • Run jQuery on click function but not on a child
  • Pass props to global context provider from function
  • How to update selected checkbox values in php mysql?
  • How can I write a regular expression that matches everything between the first and the last quote?
  • Render PDF from buffer using Node.js and JavaScript
  • Get column header and row header on cell click
  • JavaScript overriding href llinks
  • JQuery - Format Numbers in K,Lacs,Crore
  • SignalR join/leave group doesn't work correctly
  • Message page not found for few css and js files in Spring MVC project
  • Javascript - Onchange Event for checkbox works only in Firefox and Opera?
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org