#Triveraguy - Card Element

1 messages ยท Page 1 of 1 (latest)

zenith panther
#

Hi ๐Ÿ‘‹

#

Hey @signal wedge can we keep this discussion in the thread?

#

Quoting here for context

signal wedge
#

Whatever you need me to do. LOL

zenith panther
#

Okay so remind me what you are trying to do

#

Wait, sorry. Yeah you are looking to load the Stripe Card element

signal wedge
#

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.

zenith panther
signal wedge
#

Been there. Libraries are installed.

zenith panther
#

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

signal wedge
#

Right. But the first link you sent me begins with this:

#

OK... I'm reading through this and it's making sense

zenith panther
#

Right, but I expect you to keep reading

signal wedge
#

LOL

zenith panther
#

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.

signal wedge
#

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?

zenith panther
#

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.

signal wedge
#

Yes.

zenith panther
#

Way more simple that putting both front-end and back-end together

signal wedge
#

Exactly.

zenith panther
#

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

signal wedge
#

Where does that snippet go?

zenith panther
#

Which is why the code is showing the comment about 303 redirect to $session->url

#

On your PHP server

signal wedge
#

In a file named.... what (xxxxx.php) ?

zenith panther
#

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.

signal wedge
#

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.

zenith panther
#

Okay cool ๐Ÿ‘

signal wedge
#

They have no idea how to do this.

#

Nor do I.

#

We are all miffed and frustrated.

zenith panther
#

You mean you never isolate functions in PHP? Like off-load business logic? Or not redirect users?

signal wedge
#

I think they are having trouble understanding what I'm trying to do

zenith panther
#

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

signal wedge
#

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.

zenith panther
#

Makes sense to me, thats what I did

signal wedge
#

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.

zenith panther
#

Right, because you're doing it for users who already have their own Stripe acounts

signal wedge
#

No. They don't have STripe accounts

zenith panther
#

Okay so that's different from "the client"

signal wedge
#

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

zenith panther
#

Okay well you would need to use the Secret API key for the account that will have the Payment Method saved to it.

signal wedge
#

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.

zenith panther
#

Well not besides the Stripe PHP library

signal wedge
#

You mean this?

zenith panther
#

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

signal wedge
#

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?

zenith panther
#

What do you mean "use Javascript instead"?

signal wedge
#

The page you sent provides several languges

zenith panther
#

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

signal wedge
#

If I choose Java do I have to have that library?

zenith panther
#

If you choose Java (Not JavaScript) you will definitely need the library

signal wedge
#

AH, OK.

#

I'll stick with PHP

#

Unless there is a Javascript option. ๐Ÿ™‚

zenith panther
#

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

signal wedge
#

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.

zenith panther
#

Hmmm... I might be behind on some of those products.

signal wedge
#

Worldpay said that was not PCI-DSS complaint.

zenith panther
#

Since this server is for developers we don't really specialize in "no-code" solutions here

signal wedge
#

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.

zenith panther
#

Oh with the Stripe hosted Invoice page

signal wedge
#

No, not really.

#

I am soooo frustrated. What I need is SO SIMPLE, but nobody understands.

#

The Stripe rep, my developers....

zenith panther
#

Well, as I said, the simple setup here is the Checkout button. It's some code but not a lot

signal wedge
#

But they are NOT CHECKING OUT.

#

They haven't bought anything yet

zenith panther
#

Which...as I have said...is not required

#

You have the code snippet that will do this

signal wedge
#

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.

zenith panther
#

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

signal wedge
#

Why is it called the checkout button?

zenith panther
#

Because we built it to handle payments first, then expanded the capabilities when it became popular