#rocket-help
1 messages · Page 1 of 1 (latest)
Hey @shy sierra what's your question?
Please chat in this thread
not in the public channel
when i download stripe it gives me this
okay I cant just throw that in vscode it has to be in a folder
but when i put it in a folder the pathways arent the same and it effects the code
you can open the whole folder in VSCode. VS Code is just an editor, it doesn't care about anything else
no but the path does
ill need to put compoer create checkout read me public all in a folder to hold all files
no VS Code doesn't care about the path at all
But yes, the PHP installation will care
okay ill try and drag all files inside vscode not inside a folder and see what happens
Usually you don't just unzip the code in a OneDrive folder, you put it somewhere where you run your PHP server, this has nothing to do with VS Code
okay but the files must be in a folder tho to hold them all correct
yes
I'm pretty good with php ive made a login form and a contact form with a pwd recovery system as well and a newletter system
if i extract the folder and put the files inside of a folder the path way gets changed
okay so really the sample app is just a sample PHP application
and so you'd structure this the same way you would with your own PHP environment
I'd recommend just trying, I'm sorry I don't really understand what part is blocking you exactly but if you have built a PHP website before you should be able to get this to work quickly
yeah but this is my issue
lemme explain
i extract the code
i put it inside of a folder to hold it all
right
not really right no
Sorry I'm not trying to be cryptic, I'm just not sure how to explain this as it's mostly PHP specific and something you learn/figure out as a PHP developer first
i legit cannot drag and drop the files inside of my vscode unless its being held in a folder
wherever you have your PHP server running and its root folder, you can move those files in it
vscode is an IDE, it helps edit code, it's not a PHP server.
well dont i need to put the files inside of vscode to edit them
am i suppose to put them inside of xampp
really it depends what you use, there are thousands of ways to do PHP
but yes if you use XAMPP you would put the file there, wherever you put your PHP code usually
and then in VSCode you can open that folder to edit the code
possibly yes, I haven't used XAMPP in 10+ years
but wherever you have your index.php or whatever you use as your landing page
thats where all my php goes
i just downloaded this there is no landed page yet
anyways i put the code inside my htdoc it must be in a folder to be able to go into vscode to edit and modify
so once I put it in a folder it messes with the pathway for example
the instructions for stripe are
because its in a folder now (because thats the onlyway to get it in vscode) the path changed
i had to remove public from the url to access it
but when i click checkout
it brings me to this
it cannot locate that file
I have tried
<form action="/create-checkout-session.php" method="POST">
<form action="./create-checkout-session.php" method="POST">
<form action="../create-checkout-session.php" method="POST">
and none of those paths can bring me to it
and even if I get to create-checkout-session it runs require 'vendor/autoload.php'; and that file didnt come when i downloaded stripe
you see my problem now
yeah I'm sorry, I don't know how to really guide you
you keep thinking it has to be in a folder, it doesn't
when i click checkout it says Not Found probably because the path was wrong what path would i use
and if you do a folder you have to change all the include/requires path
dude do you even know how to code
i cannot put it inside vscode without the files being in a folder
only server gets dragged along
that's absolutely not true
First off all they are in a folder when you put them in XAMPP because the htdocs thing is a folder
and no we can't do that
I'm just asking for the correct path for the checkout button to work
You have to understand that XAMPP is just a wrapper around the PHP executable on your machine, it has folders like public_html and such where you can put your client-side or server-side code and this is a folder on your hard-drive and you can open that in VSCode
public_html is only for live servers
it's just an example. Whatever XAMPP does, it still access real files and folders on your hard drive
so i should grab the entire htdocs folder and put that in vscode
kind of
you put nothing in vscode really
you open vscode and then you do ctrl+O
well i want to add some files to it
and then you navigate to wherever the root of your project lives
sure you can drag files in it, but that's not really a good way of doing things
and you also said "there's no index.php" or whatever. But you, as the PHP developer, you should have that. Since you said you are experienced and have done this before. You should have a simple/basic website already built with an index.php or whatever that you know how to start and run
then you go and put the demo app's code in the same place
i just downloaded the demo app and tried using it
can we just start from scratch and walk our self through it and if we get a problem we solve it
i really need to learn how to put a payment method up im a web dev and one of my clients needs a payment method and Ive never done it before
If you have a specific question yes, but if it's about how to run a demo PHP project that's not really something I can help you with I'm sorry, that's on you to figure out as the PHP dev.
it is something you can help me with
I have explained multiple times what to do unfortunately
its probably very simple for you to
dude you must not have done it very clearly than
once i download stripe api for php i get a folder thats a zip file i then extract it right
stop calling me dude please
You get a zip archive, yes you have to extract it to access its content
ow sorry i didnt mean to assume your gender
Then, if you can't just run a simple PHP server locally yourself (like we say in the readme) you'll have to "move" the code in the right places to fit your tool (in your case XAMPP)
For example on my machine I just open a terminal, go into the server folder and use the php executable to run a server with that local folder as the root
yeah i extract it and it shows me its contents
and than i move the files and public into htdocs right
that part I don't know. Only you know, you're the experienced PHP dev using XAMPP. But yes I think that's right
this is what happens when i move it into my htdocs without giving it a main folder for all its contents
and then when i drag all files and the folder public inside vscode only public goes with it
because the files must be inside a folder to go into vscode
you keep deciding to drag stuff
this is not how you use this tool
you open VS Code first then you press ctrl+ O (the letter like Open) and then you navigate to that htdocs folder and open that
i cant open htdocs it makes me click a folder inside of htdocs
this is what happens when i click all the demo stuff inside htdocs
I mean htdocs is just a folder so I don't see why it'd do that
go to xampp
click on htdocs and then open
it just opens up the folder
it doesnt open it in vscode
it wants me to select a folder inside htdoc
okay quit that modal
and in the vscode menu click on File then "Open folder" or whatever it's called on windows and try again
when i open up my htdocs it opens every single folder inside htdocs but any files outside of any folder doesnt load
wait actually it opens everything
i run the php server
i type the address in
and it brings me that
see what i mean
did you just give up on me
I don't think so
think i should remove public/
whathappens if you visit http://localhost:4242/checkout.html ?
i get a error
idk why the server wont run
it says site cant be reached when i visit that link
all i gotta do is go inside my public folder and type this code in php -S 127.0.0.1:4242 --docroot=public
but for some reason its saying public directory doesnt exist
ok
so i ran php -S 127.0.0.1:4242 --docroot=public
inside htdocs and it works
i get that when i click checkout
[Thu Sep 29 20:47:09 2022] 127.0.0.1:55479 [404]: POST /create-checkout-session.php - No such file or directory
[Thu Sep 29 20:47:09 2022] 127.0.0.1:55479 Closing
im thinking the path is wrong but i didnt edit any of the code
this was the first problem i was having all along
also i appreciate your time i know this is stressful
it even says thats the exact path for it
yeah not sure honestly, I haven't written code on Windows in 10+ years
can you put an index.php file in this folder that just contains "hello" in it?
and then load http://localhost:4242/index.php
i can load checkout tho if i want to
i drag it and put it inside of public
but it is not originally inside of public
and then when it opens it says it needs vendor
and i didnt get a vendor file when i downloaded stripe api
ah
well that works then
that's just because you didn't read the instructions
it says you have to install stripe-php via Composer
have you ever used Composer?
yes a few times
then you have to do that first
alright will do
thats weird why i needed to drag it and put it inside the public folder why wasnt it in there originially and why didnt the path work even tho it was saying it was the correct path
weird
yeah I can't tell you much about it, that's not really how I would recommend writing PHP apps/websites
ok ive actually never used composer i thought it was something else
but i did download it
now everything set up i just gotta do this stuff now
the servers working perfectly
amazing
now you need to change the Price id and all that (there's something in the instructions on setting all your keys and info)
why am I getting this error i checked your site seen that this is how you do taxes and it still says it isnt
'automatic_tax' => [
'enabled' => true,
],
stepping in on behalf of koopajah. As the error message mentions, you need to set a tax behaviour on the Price(s) thatyou're using, have you done that yet?
thank you and no I cant seem to find out how on your website
I did come across this $product = \Stripe\Product::create([
'name' => 'Test Product',
'tax_code' => 'txcd_10000000',
]);
but where do I insert it
Is setting up stripe api suppose to be difficult or am I just special
keep in mind I'm also not that good at php
if you don't want to do it via the API, you can also do it via the Dashboard. How to do it via the API / Dashboard is covered in the link in that error message : https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-tax-behavior-on-a-price
like are there any walk through tutorials for setting up stripe start to finish using php?
also it says server.php but I didnt download a server.php file when i got the demo
and even when i make a server.php file and require it the link you sent me for tax doesnt work
there are walk through tutorials, but they're meant to guide you through a basic setup / implementation. Everyone's requirements differ and you'll need to adjust your code according to what you need.
with regards to it saying server.php - it's just indicating that this code is meant to be run in your server
if you're not familiar with it, why not do it via the Dashboard?
how do i do that
plus I wanna learn to code better with php thats another reason
will the dashboard be an easier way to get payments set up on my website
how do i do that
have you tried editing the Price in the Dashboard?
yes
what are you trying to do now - are you trying to use a no code option i.e. Payment Links or are you trying to edit a Price to include tax?
i dont wanna do it the code way im not that experienced with php
im trying to no code option
alright, do you have a question about Payment Links then?
yeah
like how do i even get it set up for my website
have a photo of my product have a price have a purchase button
and when they click the purchase button how do i make it bring them to this link
fertilizer for your farm.
im not really sure how this would all work
wait I kind of do I would have a photo of my thing I'm selling the price than a purchase button and when they click purchase it redirects them to that link
it litterly just comments out my code and doesnt let the click here button redirect them
I don't understand what you mean by it literally comments out your code and doesn't let the click here button redirect them
if you're not familiar with how to code, i'd recommend that you look into other options like Shopify or WooCommerce which is way easier to setup and choose and you can use Stripe as a gateway instead.
no i know html css and bootstrap very well
very very well
but it comments out my code turning my code into a comment
<button onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk;'">
Click Here
</button>
see where the // is
in vscode // comments out the code
so the //buy.stripe.com/dR62bYcqd44b0Ug5kk;' isnt seen as code
its seen as a comment
this is what happens when i click the button
but when you click the link i sent it goes to the right page
fertilizer for your farm.
see how the code turns green that means its a comment
and if it isnt commenting it out why doesnt it bring me to the right page im using the right url
<button onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk;'">
Click Here
</button>
like does this code not look like it would work why doesnt it
i have no context on how you're building your application, but it looks like it's currently performing URL encoding on that URL : https://www.w3schools.com/tags/ref_urlencode.ASP
If you just create a html file i.e. index.html with the below content, it works fine
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<form>
<input type="button" onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk';" value="w3docs" />
</form>
</body>
</html>
tf
how does yours work but mine doesnt
wait you put yours inside of input tags
how did you get yours to work and mine didnt what was the difference?
like i said, it probably depends on how you're compiling or building your application. All i did was to create an html file and opened it in the browser. Even if i used a button, it works also
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<button onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk';">Click Here</button>
</body>
</html>
yeah but my code doesnt work but yours does and they look similar
the layout is the same the link is the same
<input type="button" onclick="window.location.href='https://buy.stripe. com/dR62bYcqd44b0Ug5kk;'" value="w3docs" /> ----
<input type="button" onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk;'" value="click-me"/>
tops my code bottoms yours but mine doesnt work
i dont see a difference in the 2
how are you building your application? are you literally just creating a html file, or are you running some commands to build your application before it runs locally?
just running a html file
so you put that content into a file, save that file as index.html on your desktop, then double click on it to open it on your browser?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form>
<input type="button" onclick="window.location.href='https://buy.stripe. com/dR62bYcqd44b0Ug5kk;'" value="w3docs" /> my line of code is the input tag above and it doesnt work yours is the bottom and it works when you click it but i dont see a difference in the 2
<input type="button" onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk;'" value="click-me"/>
</form>
</body>
</html>
yes but my code doesnt work and yours does
but i dont see the difference
you have a typo in your code. I suggest you try copying and pasting this "as it is"
<button onclick="window.location.href='https://buy.stripe.com/dR62bYcqd44b0Ug5kk';">Click Here</button>
ow wait I see it now my '; wasnt placed properly
yeah i just noticed that
man i was looking for ever
now what else is there to do out of curiously i made a account once someone puts there credentials inside the form and click submit the payment goes through and i get paid
is everything now set up and ready to go
what else do you want it to do?
this isn't a question which i can answer. if it works well for you, then everything's great
no like is there more to the process
does the user just click the button submit the payment and everything works
yep, that's pretty much it