Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Stripe: can't attach card holder name to stripe card source

Hi everybody, I'm trying to attach the name of the cardholder to a newly created source with stripe's elements.js.

However when I submit my form I get the following error:

Received unknown parameter: name

I attach an object with that info in the createSource function, like this:

$('#payment-form').submit(function(e) {
        console.log('submitted');
        e.preventDefault();

        stripe.createSource(cardNumberElement, { name: self.cardHolder }).then(function(result) {
            if (result.error) {
                self.cardErrors = result.error.message;
            } 
            else {
                stripeSourceHandler(result.source);
            }
        });
    });

Is there any other way to store cardholder name into sources?

0 likes
1 reply
Nakov's avatar
Nakov
Best Answer
Level 73

There is no direct name parameter when creating source, so you should pass it as the owner name like this:

stripe.createSource(cardNumberElement,  { owner: { name: self.cardHolder } }).then(function(result) {
    if (result.error) {
       self.cardErrors = result.error.message;
    }  else {
       stripeSourceHandler(result.source);
    }
});

Please or to participate in this conversation.