#rocket-help

1 messages · Page 1 of 1 (latest)

granite turret
#

Hey @shy sierra what's your question?

#

Please chat in this thread

#

not in the public channel

shy sierra
#

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

granite turret
#

you can open the whole folder in VSCode. VS Code is just an editor, it doesn't care about anything else

shy sierra
#

no but the path does

#

ill need to put compoer create checkout read me public all in a folder to hold all files

granite turret
#

no VS Code doesn't care about the path at all

#

But yes, the PHP installation will care

shy sierra
#

okay ill try and drag all files inside vscode not inside a folder and see what happens

granite turret
#

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

shy sierra
#

okay but the files must be in a folder tho to hold them all correct

granite turret
#

not really

#

have you done PHP development before?

shy sierra
#

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

granite turret
#

okay so really the sample app is just a sample PHP application

shy sierra
#

instead of

granite turret
#

and so you'd structure this the same way you would with your own PHP environment

shy sierra
#

all the code needs to be inside of a main folder

granite turret
#

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

shy sierra
#

yeah but this is my issue

#

lemme explain

#

i extract the code

#

i put it inside of a folder to hold it all

#

right

granite turret
#

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

shy sierra
#

i legit cannot drag and drop the files inside of my vscode unless its being held in a folder

granite turret
#

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.

shy sierra
#

well dont i need to put the files inside of vscode to edit them

#

am i suppose to put them inside of xampp

granite turret
#

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

shy sierra
#

okay so i put my files inside of my htdocs

#

which is my php server

#

xampp>htdoc

granite turret
#

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

shy sierra
#

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

granite turret
#

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

shy sierra
#

when i click checkout it says Not Found probably because the path was wrong what path would i use

granite turret
#

and if you do a folder you have to change all the include/requires path

shy sierra
#

dude do you even know how to code

granite turret
#

lol

#

yes I do

shy sierra
#

i cannot put it inside vscode without the files being in a folder

#

only server gets dragged along

granite turret
#

that's absolutely not true

shy sierra
#

i just tried it

#

can we do like a teamviewer or something

granite turret
#

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

shy sierra
#

I'm just asking for the correct path for the checkout button to work

granite turret
#

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

shy sierra
#

public_html is only for live servers

granite turret
#

it's just an example. Whatever XAMPP does, it still access real files and folders on your hard drive

shy sierra
#

so i should grab the entire htdocs folder and put that in vscode

granite turret
#

kind of

#

you put nothing in vscode really

#

you open vscode and then you do ctrl+O

shy sierra
#

well i want to add some files to it

granite turret
#

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

shy sierra
#

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

granite turret
#

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.

shy sierra
#

it is something you can help me with

granite turret
#

I have explained multiple times what to do unfortunately

shy sierra
#

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

granite turret
#

stop calling me dude please

#

You get a zip archive, yes you have to extract it to access its content

shy sierra
#

ow sorry i didnt mean to assume your gender

granite turret
#

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

shy sierra
#

yeah i extract it and it shows me its contents

#

and than i move the files and public into htdocs right

granite turret
#

that part I don't know. Only you know, you're the experienced PHP dev using XAMPP. But yes I think that's right

shy sierra
#

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

granite turret
#

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

shy sierra
#

ok i clicked ctrl + o

#

shows me that

granite turret
#

then choose htdocs

#

and open that folder

shy sierra
#

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

granite turret
#

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

shy sierra
#

it just opens up the folder

#

it doesnt open it in vscode

#

it wants me to select a folder inside htdoc

granite turret
#

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

shy sierra
#

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

granite turret
#

no I just don't know

#

why do you have /public in the URL?

shy sierra
#

thats what is required in the readme instructions

granite turret
#

I don't think so

shy sierra
#

think i should remove public/

granite turret
shy sierra
#

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

granite turret
#

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?

shy sierra
#

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

granite turret
#

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?

shy sierra
#

yes a few times

granite turret
#

then you have to do that first

shy sierra
#

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

granite turret
#

yeah I can't tell you much about it, that's not really how I would recommend writing PHP apps/websites

shy sierra
#

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

granite turret
#

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)

shy sierra
#

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,
],

compact harness
#

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?

shy sierra
#

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

compact harness
shy sierra
#

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

compact harness
#

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?

shy sierra
#

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

compact harness
#

how do i do that

have you tried editing the Price in the Dashboard?

shy sierra
#

this dashboard

compact harness
#

yes

shy sierra
#

ok

#

i clicked the nocode

#

and got a custom link

compact harness
#

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?

shy sierra
#

i dont wanna do it the code way im not that experienced with php

#

im trying to no code option

compact harness
#

alright, do you have a question about Payment Links then?

shy sierra
#

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

#

im not really sure how this would all work

shy sierra
#

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

compact harness
#

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.

shy sierra
#

no i know html css and bootstrap very well

#

very very well

#

but it comments out my code turning my code into a comment

#

see where the // is

#

in vscode // comments out the 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

#

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

#

like does this code not look like it would work why doesnt it

compact harness
#

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>
shy sierra
#

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?

compact harness
#

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>
shy sierra
#

yeah but my code doesnt work but yours does and they look similar

#

the layout is the same the link is the same

#

tops my code bottoms yours but mine doesnt work

#

i dont see a difference in the 2

compact harness
#

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?

shy sierra
#

just running a html file

compact harness
#

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?

shy sierra
#

<!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

compact harness
#

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>
shy sierra
#

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

compact harness
#

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

shy sierra
#

no like is there more to the process

#

does the user just click the button submit the payment and everything works

compact harness
#

yep, that's pretty much it

shy sierra
#

okay thanks

#

ugh 1 more question it says hst for 100$ product in canada is 11.50 but hst is 13$ so how does that make sense