#johnl_code
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- johnl_code, 13 minutes ago, 8 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1259723328764252224
đ Have more to share? Add details, code, screenshots, videos, etc. below.
Hi there, so you want to surface name and email in PaymentElement?
Yes, I want there to be an fname, lname, and email textbox and I want to receive it on the server (in Golang)
OK. you need to use AddressElement instead https://docs.stripe.com/elements/address-element, and you can set its defaultValues through https://docs.stripe.com/js/elements_object/create_address_element#address_element_create-options-defaultValues
That's a good first step, but I don't want to ask for an address, just fname, lname, and email
This doesn't even ask for email
Address is mandtory for AddressElement. In this case, you might want to build your own form to surface these info.
Okay, sure, but what about email?
Is there an email element
No, AddressElement doesn't collect email.
No, there's no element dedlciated for email address collection. There's a Link Authentication Element (https://docs.stripe.com/payments/elements/link-authentication-element) that collects email address, but that's for Link authentication purpose.
I see, how would I be able to do this then?
Like build a form completly from scratch?
Including credit card info?
No. You should still use PaymentElement to collect senstive card info. You can build you own UI to collect name and email, and put your own UI together with PaymentElement.
I see. I was actually experimenting with that a bit
I had this
But the issue was that the data was sent to the server at page load rather than when the button was pressed
And my server was like this
so I was trying to do req.Fname
issue was that the data was sent to the server at page load rather than when the button was pressed -> I don't quite understand this part, can you elaborate or show me the relevant code?
Like... you know how the Cost is sent on page load?
And then the user pays
Basically I was handling the fname, lname, email stuff the same was as cost is sent to the server
I'm not sure if I understand you. But if you want to send the name and email info during payment confirmation, you can do so through https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details
I am honestly struggling to understand these docs because it doesn't have any code examples... one sec
Is it saying this?
Ah, you should put this info under the payment_method_data.billing_details hash.
Yes you are right!
You should follow the billing_details data strcutre https://docs.stripe.com/api/payment_methods/create#create_payment_method-billing_details
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
There's no lname or fname, just name
If you are using paymentElement, you should call confirmPayment, not confirmCardPayment
I am though?
The screenshot that you posted earlier is using confirmCardPayment
oooh, that was from the docs, not my code
This is my current code
For some reason, the payment form now doesn't show up
I prob need card: cardElement?
cardElement isn't defined anywhere tho
That didn't change anything
The error message already explained the problem. have you obtained a clientSecret from backend and initalize the stripe eleements with it?
Initalize^
handleSubmit^
I prob sound really dumb, I'm not a JS dev or anything, but isn't the code already doing that?
I'd suggest you to go through this doc and follow it step by step https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
Okay, I will do that. Do you think you can keep this channel open for the 24 hours?
This thread will be clsoed after sometime. Feel free to use the buttons on #help to start a new thread.
okay