#BRData
1 messages · Page 1 of 1 (latest)
Hi 👋
We don't expose direct access to individual inputs in the Payment Element. What are you trying to do?
So right now my payment element includes them entering their email - first name last name and address
<form id="payment-form">
<div id="link-authentication-element">
<!--Stripe.js injects the Link Authentication Element-->
</div>
<div id="payment-element">
<!--Stripe.js injects the Payment Element-->
</div>
<h3>Address</h3>
<div id="address-element">
<!-- Elements will create form elements here -->
</div>
<br />
<button id="submit">
<div class="spinner hidden" id="spinner"></div>
<span id="button-text">Pay now</span>
</button>
<div id="payment-message" class="hidden"></div>
</form>
How can I access those?
for example: document.getlemenetById("StripeElementFirstName").value
You will want to listen for the change event on the Payment Element. https://stripe.com/docs/js/element/events
This will fire as your users enter data and provide you the values they have entered.
I am actually trying to grab it on the hanldeSubmit function
Yeah, I would listen to the change event instead
Well I need to grab everything at once is there any way to use document.getElementById("something").value so I can grab their first name that they entered in one of the payment elemnts
No that is the kind of access we don't permit
Hmm, well when I go to call var result = service.Get(paymentIntent, new PaymentIntentGetOptions(), requestOptions);
How come in that JSON data there is no first name last name and address?
Even though I am collecting that data on the payment
It looks like you would be collecting that in the Address element.
So you could use this approach to get that data; https://stripe.com/docs/js/elements_object/get_value_address_element
this is my payment element currently
But this is all the data that I am getting from the service.Get call
{
"id": "pi_3NIEDSEVoNb8mE921NTyCQEx",
"object": "payment_intent",
"last_payment_error": null,
"livemode": false,
"next_action": null,
"status": "requires_capture",
"amount": 12678,
"amount_capturable": 12678,
"amount_details": {
"tip": {
}
},
"amount_received": 0,
"application": "ca_NrJv5qLdr7fpGig7aqUpSmY5RY15kGDb",
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "manual",
"client_secret": "xxx",
"confirmation_method": "automatic",
"created": 1686589662,
"currency": "usd",
"customer": null,
"description": null,
"invoice": null,
"latest_charge": "ch_3NIEDSEVoNb8mE9217Pr5LW1",
"metadata": {
},
"on_behalf_of": null,
"payment_method": "pm_1NIEF3EVoNb8mE92kmAemq90",
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"processing": null,
"receipt_email": "testingzz@aol.com",
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"transfer_data": null,
"transfer_group": null
}
Why is first and last name not an option in there?
This data is saved to the Payment Method. You can retrieve it using the ID returned and examine the billing_details property to get this information
Can you explain further what you mean by that
how would I get the billing_details property
when that doesnt come up in the service.Get
The billing details property exists on the Payment Method. You could either make a separate Get request to retrieve the method or you could include payment_method in the expand parameter when requesting the Payment Intent.
We cover expanding response here: https://stripe.com/docs/expand
Hmm, this is currently what I have: var requestOptions = new RequestOptions();
requestOptions.StripeAccount = "acct_xxx";
var service = new PaymentIntentService();
var result = service.Get(paymentIntent, new PaymentIntentGetOptions(), requestOptions);
How can I include the expand into this since I am using a stripe account id to get this payment info
You can set the Stripe-Account header AND also do expansion
Confused what you mean by that to be honest
StripeAccount is something you set in requestOptions and expansion is something you'd set as part of PaymentIntentGetOptions
I see nothing talking about paymentintentgetoptions in this document: https://stripe.com/docs/expand
That doc is meant to explain the concept of expansion and just give examples
So no, there's no specific example that uses PaymentIntentGetOptions , but there are other examples that do get requests, and it'd be very similar
Im honestly still very confused on how to incorporate that into this:
var requestOptions = new RequestOptions();
requestOptions.StripeAccount = "xxx"
var service = new PaymentIntentService();
var result = service.Get(paymentIntent, new PaymentIntentGetOptions(), requestOptions);
What would I change the service.Get line to?
You'd change PaymentIntentGetOptions to also set Expand and include payment_method in that list