#Willys-checkout-fields

1 messages ยท Page 1 of 1 (latest)

dusty bane
#

Hey! You mean like prefilling the existing fields? Or adding additional custom fields?

plucky wraith
#

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

dusty bane
#

You're using Elements, right?

plucky wraith
#

I'm

dusty bane
#

Does that help?

plucky wraith
#

I'm going through right now

dusty bane
#

Not sure how useful that is โ€“ what exactly do you want to do with the user info?

plucky wraith
#

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

dusty bane
#
stripe.confirmPayment({
  elements,
  confirmParams: {
    payment_method_data: {
      billing_details: {
        email: 'xxx@stripe.com'
      }
    }
  }
})
plucky wraith
#

ahh nice thanks a lot! I will have a look

dusty bane
#

Complicates the integration a little but then you can store payment data securely in Stripe to be used in future transactions

plucky wraith
#

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

dusty bane
#

Likely a PHP variable in the HTML I guess

plucky wraith
#

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

dusty bane
#

Where is that input field from?

plucky wraith
#

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>

desert sparrow
#

Hi there ๐Ÿ‘‹ ynnoj had to step away, and I'm getting caught up on this thread.

plucky wraith
#

hi Toby ๐Ÿ‘‹

#

thank to Ynnoj for his time and help ๐Ÿ™‚

desert sparrow
#

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.

plucky wraith
#

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

desert sparrow
#

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.

plucky wraith
#

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

desert sparrow
#

Gotcha, so we know where the information needs to go. Are you already collecting the customer's email address somewhere in your process?

plucky wraith
#

yup

#

there will be a session with user_id open from it i can get the email

desert sparrow
#

And how/where is that stored?

plucky wraith
#

in a database

#

sorry for the delay

#

but I can extract is very easily

plucky wraith
#

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>

neat saffron
#

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

plucky wraith
#

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 ?

plucky wraith
#

well it's more about: does the form data redirect directly to checkout.js?

fiery sapphire
#

@plucky wraith I'm not sure what that question could mean honestly. There's no form to redirect to Checkout

plucky wraith
#

Hi koopajah

#

let's take my problem from the beginning

#

I'm trying to use this to create only payment

fiery sapphire
#

I read the conversation

#

you do seem quite lost/completely lost

plucky wraith
#

maybe

fiery sapphire
#

totally fine but you seem to still think you use Checkout but aren't using Checkout and use Elements right?

plucky wraith
#

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

fiery sapphire
#

Okay so what's blocking you exactly?

plucky wraith
#

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

fiery sapphire
#

you put it in a hidden form input for example and then in JS you go and read it

plucky wraith
#

is that it?

fiery sapphire
#

Yes it's really that simple. There's nothing Stripe specific in that part of your code/logic. It's just PHP/JS logic

plucky wraith
#

I thought that the form sent info to an other page which then sent it to checkout.js