Transitioning from utilizing Stripe Checkout to implementing Stripe Elements

After using Stripe Checkout for a while, I've decided to make the switch to Stripe Elements. You can find more information about Stripe Elements here.

When sending the name and address fields as tokenData, I follow this format:

let tokenData = {
    name,address_line1, address_line2, address_city, address_state,address_zip, address_country
};

stripe.createToken(card, tokenData).then(function(result) {
  if (result.error) {
    // Display error message.
   var errorElement = document.getElementById('card-errors');
    errorElement.textContent = result.error.message;
  } else {
    // Send token to server.
    stripeTokenHandler(result.token);
  }
});

The transactions in the sandbox are going smoothly, but upon checking the network call made by Stripe to create the token, it seems that the entered name and address details don't affect the creation of the token as long as the card is valid:

{
  "id": "tok_1EaOS2FLdOnSFAAaFkMjkKmu",
  "object": "token",
  "card": {
    "id": "card_1EaOS2FLdOnSFAAaHXi9klGu",
    (... full card details ...)
  },
  "client_ip": "122.122.122",
  "created": 1557931886,
  "livemode": false,
  "type": "card",
  "used": false
}

I recall that with Stripe Checkouts, this was handled automatically, but now it seems different with Stripe Elements.

Answer №1

When using Stripe Elements, the card number, expiry date, and CVC are validated, but address validation is not included in the createToken process.

Typically, banks do not require an address for a charge, so it is left to you to handle address validation in your implementation.

Legacy Checkout provided basic address validation because Stripe controlled the UI elements, but it was limited compared to the current validation process with Elements.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

remove function erases all the data in Vue

My goal is to delete only the item that has been clicked on. todoList Component: template : <ul class="list-group"> <todo v-for="(todo,i) in todo" :key="i" :todoString="todo.todoString" : ...

Creating a personalized message for a failed "Get" request using the HTTPS native module in combination with

Currently, I have implemented an Express application that includes an HTTP GET request to an external API. It functions properly when there are no errors; however, I am looking to customize the response sent to the client-side in case of failures: const ht ...

Send an argument from a function to the callback function of this.setState

I'm currently dealing with a challenge. I am attempting to send a parameter from a function to the callback of this.setState, but I am struggling to understand how this can be done. This is what my code looks like: selectHandler(event){ this.se ...

Angular model is not receiving the value of a false checkbox

One issue I am facing is with a form that includes a checkbox bound to an ng-model property. The problem arises when the checkbox is checked, as the value gets set in the model. However, when it is unchecked, the key and value remain unset, causing API val ...

Ways to set Material UI tabs as active exclusively for particular URLs

Looking for a solution to address a conflict arising from the active tab indicator being located on the right tab. Within my navbar, I have tabs leading to three different routes, two of which are quite similar. <Tabs indicatorColor="primary" ...

Pausing repetitive HTTP requests in an Angular 6 project within a do while loop

While waiting for the completion of one API call, I am recursively consuming an external API. The http calls are being made using import {HttpClient} from '@angular/common/http' As a newcomer to the framework, there may be something wrong in the ...

Preventing browser flickering when using 'loadURL' to switch between URLs in Electron

Within my electron app, I am utilizing a singular window. As users navigate through the various "forms" within the application, I make use of the mainWindow.loadURL('file://...') function. Unfortunately, this approach leads to a flashing effect w ...

What is the best way to initialize a value asynchronously for React context API in the latest version of NextJS, version

Currently, I'm working on implementing the React context API in my NextJS e-commerce application to manage a user's shopping cart. The challenge I'm facing is how to retrieve the cart contents from MongoDB to initiate the cart context. This ...

What is preventing the installation of this Chrome extension?

I am struggling to install a few short and simple extensions on Chrome. The error message I receive about the 'manifest version' indicates that the issue might be due to outdated information. Since I lack experience in Chrome extensions and JavaS ...

Wheelnav.js implementing a dynamic bouncing animation

I'm currently in the process of working on a pie menu with wheelnav.js and everything is going smoothly so far. However, I can't seem to find any information in the wheelnav.js documentation on how to eliminate the bouncing effect when a menu cho ...

Tips for transmitting form information in a fetch call

As I was developing a nodejs server, I encountered an issue with the POST call that involves sending form input data to a remote server. Despite everything else working fine, the form data was not being received by the server. Below is the code snippet in ...

What is the best way to display the value of an option in an HTML element

I would like to include an h2 element that displays an updated price based on the selected option value. Below is my current code snippet: <select name="price"> <option value="2799"> 1-6 installments</opt ...

A snippet of jQuery programming that enables automatic transitions between images

Trying to figure out how to achieve this - I want an image to change every 3 seconds using jquery. Can anyone help me with this? Unfortunately, I haven't been able to find any resources on this specific topic. ...

Retrieving data from MongoDB and presenting it neatly in Bootstrap cards

I have successfully retrieved data from MongoDB and displayed it in Bootstrap 5 cards. However, I am facing an issue where all the cards are appearing in a single row if there are multiple entries in the database. What I want to achieve is to utilize the ...

The ng-click function ceases to trigger after the $location dependency is included in the controller

I need some help with running a ng-click function from my controller. The strange thing is, when I don't use the $location dependency, the ng-click function works fine. But as soon as I add $location to the controller, the ng-click function stops work ...

Trouble with fetching data from input fields using jQuery

I am having trouble retrieving values from the input fields. When I use an alert box, it shows that there are no values. I have reviewed my code and I can't seem to find any errors. Could it be that I forgot to include something in my code? <div c ...

Working with URL query parameters in node.js

I am tasked with developing a function that takes an object from the URL as input. The main aim is to update the menu items for a restaurant. The query sent will be in this format: ?restId=1&posId=1&groups=…&items= [{"id":"000 ...

Node.js: Issue with redirecting on Stripe post route

I've encountered an issue while setting up the Stripe API. Currently, all charges are being successfully processed and reflected on my Stripe dashboard. However, I'm facing difficulties with redirection after processing a charge. Below is the PO ...

What are the benefits of using `observer` over `inject` when passing data to a React component in MobX?

After reading MobX documentation, it appears that using observer on all components is recommended. However, I have discovered that by utilizing the inject method, I am able to achieve more precise control over which data triggers a re-render of my componen ...

Calculating the angle formed by three vectors in three-dimensional space

According to the solution(s) provided in this post Angle between 3 points in 3d space, there is a JavaScipt function that calculates the angles between three vectors in 3D space. The function calculates the angles as if each vector is a vertex on a surface ...