#Willys-checkout-fields
1 messages ยท Page 1 of 1 (latest)
Hey! You mean like prefilling the existing fields? Or adding additional custom fields?
the only fields for now are credit cards informations, I'm planning to have my user register their data in a previous form so I will have their info already store somewhere, is it possible to pass them through the payment form via hidden input for exemple?
like email, name and firstname
You're using Elements, right?
I'm
You can pass additional parameters to the confirmPayment call in Stripe.js: https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data
Complete reference documentation for the Stripe JavaScript SDK.
Does that help?
I'm going through right now
Not sure how useful that is โ what exactly do you want to do with the user info?
I don't really find what I've been looking for... and indeed if I don't give you the purpose it will ba hard for you to help ahah, It's just to pass it into the payment section on stripe
so I know who payed what
in case I need to rembourse or contact them for any reason
Well you can pass an email with this parameter
stripe.confirmPayment({
elements,
confirmParams: {
payment_method_data: {
billing_details: {
email: 'xxx@stripe.com'
}
}
}
})
Or you could create Customer objects in Stripe: https://stripe.com/docs/api/customers
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ahh nice thanks a lot! I will have a look
Complicates the integration a little but then you can store payment data securely in Stripe to be used in future transactions
Well I won't be using user object, maybe in a v2, but I the first option you provided seems to fit my need
I'm just wondering how to get the email from my form to checkout.js
Likely a PHP variable in the HTML I guess
There might be something useful here: https://github.com/stripe-samples
not really I'm wondering if a <input type="hidden" name="" value="<?php echo email;?>"/> exists that is taken into account by stripe to insert it directly from the form to the the payment page
I mean to send it to checkout.js then to the payment page
trying to find the easiest path
Where is that input field from?
I did it myself
I would like to insert it in checkout.html (I would make it a .php) to send the email data
with the rest of the form
this works pretty fine, but in order to have the real email I need to get it from the data the user provided, so I need to include it from somewhere, as I have it in my checkout.php (previously checkout.html) is there a way I can pass the information to checkout.js? (maybe I was not clear about what I wanted to do, I hope it helps) thanks for your time and help
stripe.confirmPayment({
elements,
confirmParams: {
payment_method_data: {
billing_details: {
email: 'xxx@stripe.com'
}
}
}
})
<form id="payment-form">
<input type="hidden" name="" value="<?php echo email;?>"/>
</form>
Hi there ๐ ynnoj had to step away, and I'm getting caught up on this thread.
Thanks for your patience while I read the thread. There isn't a way to directly insert it into our elements, but I would expect that you could echo the value into your DOM (as you mentioned earlier) and then reference that element's value when making the confirmPayment request.
Oh, or actually you might be able to echo the PHP variable directly into a js variable.
could be a great idea, but where should I be able to get the data? in create.php?
when I say get is retrieve
I have it, just don't know how/where to include it
https://dashboard.stripe.com/test/payments to have it display over there in "client"
Would you be able to send a quick screenshot (just to ensure we're on the exact same page) of where you're hoping to get the email address to display? I think I'm a bit confused on what you're trying to accomplish.
where the email is display I would like to have it display for any customer
it's working since I've added this from your colleague in checkout.js
stripe.confirmPayment({
elements,
confirmParams: {
payment_method_data: {
billing_details: {
email: 'exemple@test.com'
}
}
}
})
I need to replace the bold string with my variable but I don't know where to get it from
Gotcha, so we know where the information needs to go. Are you already collecting the customer's email address somewhere in your process?
And how/where is that stored?
i can have it in checkout.php (checkout.html) <form id="payment-form"> and integrate it
<input type="hidden" name="" value="<?php echo email;?>"/>
</form>
That sounds viable. You can also create a Customer object yourself server side and use it when creating the PaymentIntent. Either of them will associate the email with the payment
yup I will do the customer object in a v2 I think but for now I will keep it simple ahah, my question is how can I get this input data from checkout.php to checkout.js ?
well it's more about: does the form data redirect directly to checkout.js?
@plucky wraith I'm not sure what that question could mean honestly. There's no form to redirect to Checkout
Hi koopajah
let's take my problem from the beginning
I'm trying to use this to create only payment
maybe
totally fine but you seem to still think you use Checkout but aren't using Checkout and use Elements right?
I'm using exactly what I just sent you
the pages being called checkout.html/js
the checkout.html I changed it into checkout.php to be able to display it only if the user already has a session
and I'm trying to add to the payment page into "client" on stripe the email of the user
Okay so what's blocking you exactly?
so, I have on checkout.php the user email and I would like to pass it to checkout.js to have it in the billing_details. but I don't know how I can pass the information from checkout.php to checkout.js
you put it in a hidden form input for example and then in JS you go and read it
is that it?
Yes it's really that simple. There's nothing Stripe specific in that part of your code/logic. It's just PHP/JS logic
I thought that the form sent info to an other page which then sent it to checkout.js