#Triveraguy - Card Element
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Hey @signal wedge can we keep this discussion in the thread?
I'll tighten up the white space after I get this working, but here's the page:
https://www.boatgasrefueling.com/index.php?cID=177
BoatGas Marine Refueling Service :: Welcome Aboard
Thank you for registering for Boatgas Marine Re-fueling Service!
Thank you for registering for Boatgas Marine Re-fueling Service!
Quoting here for context
Whatever you need me to do. LOL
Okay so remind me what you are trying to do
Wait, sorry. Yeah you are looking to load the Stripe Card element
Collect credit cards for later charging and processing (no charges or subscriptions now). My client will go to his dashboard, and charge the collected cards after he provides his service.
Yes. That.
Right, okay so first you'll want to familiarize yourself with our basic approach for storing cards for later use here:
https://stripe.com/docs/payments/save-and-reuse
Been there. Libraries are installed.
This isn't about installing libraries
It's showing you the exact code you need to load an element in your front-end to collect card details
Like in this section: https://stripe.com/docs/payments/save-and-reuse#web-collect-payment-details
Right. But the first link you sent me begins with this:
OK... I'm reading through this and it's making sense
Right, but I expect you to keep reading
LOL
But the key parts (IMO) are understanding how your server & client will communicate between each other and the Stripe APIs to allow you to save cards.
I really just need Stripe to provide a form that collects the card info puts it into Stripe in a way that my client can find them when he's filled their gas tank and needs to charge them.
Is this what does that?
Okay that is actually what I remember discussing with you. In that case i was suggesting you use our Checkout form to collect card details. the mode => "setup" is what means the Checkout form will only collect card details and save them as a Payment Method.
Yes.
Way more simple that putting both front-end and back-end together
Exactly.
So yes, the code snippet you provided will create the Checkout Session. The object it returns will have a url property. You need to redirect your front-end user to that URL
Where does that snippet go?
Which is why the code is showing the comment about 303 redirect to $session->url
On your PHP server
In a file named.... what (xxxxx.php) ?
It should get triggered when your user clicks a button or something on your site indicating they want to save a card
That's entirely up to you
That's getting into a whole other topic of "How to build a PHP website" which is beyond what I can speak to.
I've been building php based websites for 26 years. LOL
I've asked two devs on my team (who also have been building php-based websites for years) to help me figure this out.
Okay cool ๐
You mean you never isolate functions in PHP? Like off-load business logic? Or not redirect users?
I think they are having trouble understanding what I'm trying to do
I mean, I guess you could keep the function to create the Checkout session in the same PHP file as whatever is running the page the user is on. You'll just want to create the Session and redirect the user as a result of a button click or something like that
They are thinking they should be putting both front-end and back-end together.
I just want a customer to click a button that goes to Stripe, and collects their card info in my clients account so he can find them later to charge them in his dashbaord.
Makes sense to me, thats what I did
I understand (I think) that is just need the button to take the API key for my client's account and send them to a form that collects their email address, name, Card #, Exp, Code.
They hit enter, get a confirmation, and we're done.
Right, because you're doing it for users who already have their own Stripe acounts
No. They don't have STripe accounts
Okay so that's different from "the client"
The customers have boats that need gas tanks filed, and have a credit card they want my client to have on file to charge when he fills their tanks
Okay well you would need to use the Secret API key for the account that will have the Payment Method saved to it.
Right
I have secret API key.
I just need to know where to put that snippet you sent above with the API key to make the button on this page do that
If the checkout button just needs to call a simple php file with nothing more than that snippet, then that's easy.
Do I need any libraries installed on my server? I'm now assuming no.
Well not besides the Stripe PHP library
You mean this?
I'm not sure about those files. This is what I'm familiar with: https://github.com/stripe/stripe-php
In the minor PHP development I've done I've always used Composer to manage my dependencies
So composer require stripe/stripe-php + require_once('vendor/autoload.php'); does the trick for me
Yeah. that's what I grabbed and installed.
That's where/how Composer installs them.
If I use Javascript instead would I need any of that?
What do you mean "use Javascript instead"?
The page you sent provides several languges
If you switch your server to Node.js then you'll need the corresponding Stripe library. If you try to handle creating the checkout session entirely client side, I'm not certain you can configure it for setup. mode
If I choose Java do I have to have that library?
If you choose Java (Not JavaScript) you will definitely need the library
That's Node.js, still need the Stripe Library
Also the Stripe library is massively useful feature. I'm not sure why you are trying to avoid it.
Automatic retries, idempotent API requests, webhook signature verification, good stuff
Because I don't need any integration of any of this into the website. LOL. I just need my client's customers to be able click a button to go somewhere to give him their credit card info. And nothing more. The Stripe rep said Stripe can do that, with no code.
All that other stuff is great, I'm sure. But I previously just used a form to save the credit card info so my client had his customer's credit card info on file, to manually charge them as needed.
Hmmm... I might be behind on some of those products.
Worldpay said that was not PCI-DSS complaint.
Since this server is for developers we don't really specialize in "no-code" solutions here
Right. It turns out that he was assuming that the no code "Subscription" would work.
And so I now know that there isn't a nocode solution.
Oh with the Stripe hosted Invoice page
No, not really.
I am soooo frustrated. What I need is SO SIMPLE, but nobody understands.
The Stripe rep, my developers....
Well, as I said, the simple setup here is the Checkout button. It's some code but not a lot
Which...as I have said...is not required
You have the code snippet that will do this
They are simply submitting their credit card so my client has them on file. Checking out happens when my client has filled their tank, and calculates a unique purchase price, and he uses his dashabord to to find their card and charge ti
OK. I need a drink and dinner.
The code snippet will not charge them, it will collect the required information and create the payment method
It's the simplest approach given what you want
Why is it called the checkout button?
Because we built it to handle payments first, then expanded the capabilities when it became popular