#lsantaniello - cardholder name
1 messages · Page 1 of 1 (latest)
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
You should be able to find that as the name on the related customer object https://stripe.com/docs/api/customers/object#customer_object-name
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I need to enable field into card form in my mobile app
Which mobile SDK are you using?
<script src="https://js.stripe.com/v3/" async></script> mobile
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?
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
Found the link to this field in the doc. https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details
Looking for an example snippet on how to pass it in...
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
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
thanks, very clear
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.