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.