#lsantaniello - cardholder name

1 messages · Page 1 of 1 (latest)

molten fulcrum
#

Hello, are you working server side or client side here?

#

ionic app uses stripe element. In order to generate payment intent I call backend api developed in php

trail whale
#

I need to enable field into card form in my mobile app

molten fulcrum
#

Which mobile SDK are you using?

trail whale
#

php server type

#

[SERVER SIDE]

$paymentIntent = \Stripe\PaymentIntent::create([
        'amount' => $amount,
        'currency' => 'eur',
        'automatic_payment_methods' => [
            'enabled' => true,
        ],
        'description' => 'Ordine N. ' . $idOrder . " Mobile",
        'capture_method' => 'manual'
]);
#

[MOBILE SIDE]

const elements = this.stripe.elements(options);
this.card = elements.create('payment');

#

@molten fulcrum could you please help me?

molten fulcrum
#

Yep yep, was just getting back to this. That payment element does not have a cardholder name field itself but you can create your own and pass in the name while confirming your payment

#

Looking for an example snippet on how to pass it in...

trail whale
#

is this for confirm not for create

#

I'd like to add a new text field into card element shown into mobile app during payment

#

user must ass card number, expired date, ccv and also cardholder's name

molten fulcrum
#

Unfortunately you can't add custom fields to the element at the moment. The recommended approach is to add your own custom field on the same page, the confirm thing that I was talking about is how you pass the cardholder name from your form to the confirmPayment call so that the name is in our system

trail whale
#

thanks, very clear

molten fulcrum
#

So you can pass the name in like this:

      //`Elements` instance that was used to create the Payment Element
      elements,
      confirmParams: {
        return_url: 'https://example.com/order/123/complete',
        payment_method_data: {
          billing_details: {
            'name': 'Jenny Rosen'
          }
        }
      },```
And then on your server side, you can see the name you passed in in the `billing_details.name` field on the PaymentMethod that that creates https://stripe.com/docs/api/payment_methods/object#payment_method_object-billing_details-name