#mayadelasriveras - testing PHP quickstart

1 messages · Page 1 of 1 (latest)

teal schoonerBOT
surreal crystal
#

Hi there 👋 which payment front are you talking about? What are you hoping to do?

stuck flax
#

integrated stripe

#

integrate pay

#

this is

#

there

surreal crystal
#

Alright, and where are you running into a blockage?

stuck flax
#

when I download all the code and run it on my test localhost

#

It only shows me the payment button, it does not show me the entire screen to enter the card data.

surreal crystal
#

What happens when you click the button?

stuck flax
#

nothing I can not enter data because the form does not appear all only the payment button

surreal crystal
#

Does your code deviate at all from the tutorial you posted?

stuck flax
#

it is not the same just change the names to spanish

surreal crystal
#

Can you post all the relevant code here?

stuck flax
#

i create stripe.php, index, stripe.js and stripe.cscs

surreal crystal
#

Please don't post code that has your API keys in them. Can you redact them and copy/paste again?

stuck flax
surreal crystal
stuck flax
#

create.php es stripe.php, pago. html es index.html, checkout.js es stripe.js y checkout.css es stripe.css

#

this is my name of file

#

i need snow what is the problems in this tutorial

surreal crystal
#

If your code is identical to the code we give you in those docs, then the file names will need to be identical as well. Otherwise there's no way for the code to know where to look for the resources it needs.

stuck flax
#

Excuse me, the js gives me a syntax error when I do my test on my local host, I tried them, it works

surreal crystal
#

Okay, and what is the syntax error?

stuck flax
#

this is when i run it on my localhost and inspect it

#

this is the screen you should see

vale shore
#

Can you add some logging to your code to see how for it gets / where exactly its failing?

stuck flax
#

I don't know how to do it because I can't enter the card data

#

I insist this is the code of the tutorial example or the one predesigned by you

#

probando con los mismos nombres

vale shore
#

I understand, but I need to more about where exactly its failing. Looking at the screenshot you shared, it appears stripe.js is failing during initialization. Did you provide your publishable key?

#

Where is that 500 error coming from? You'll need to inspect the running code a little more closely I'm afraid, in order fr me to help you through this.

#

Can you explain what you did to run the code?

stuck flax
#

just put my api key and try it from my localhost

vale shore
#

Did you run the code with a local PHP webserver?

#

As we show in step 5: php -S 127.0.0.1:4242 --docroot=public

#

It's not expected that you open the php files directly with the browser

stuck flax
#

not with my appserve

#

and as I try it then in the previous version I did the same and it opens perfectly

#

this was my old test until i change the upload form for card data

vale shore
#

What do you mean previous version?

stuck flax
#

the payment front before this

#

Hey, I need it to open up and let me load the cards and allow me to continue with the integration. Can you help me to make the front end work?

vale shore
#

That's what i'm trying to do, but the code is designed to be run with the PHP web server, then the client side makes requests to the backend

#

mayadelasriveras - testing PHP quickstart

stuck flax
#

hello

#

this error new

vale shore
#

OK, can you share the network request that failed?

#

It looks like the client got a 404 error back from trying to call /create.php

stuck flax
#

ok but how can I correct that 404 error I can't believe this is the same code the same files and it gives me an error

#

// Fetches a payment intent and captures the client secret
async function initialize() {
const { clientSecret } = await fetch("/create.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items }),
}).then((r) => r.json());

#

the error is here

#

there

vale shore
#

OK, great! And it looks like that fails due to a 404 on the /create.php call

#

If you try to curl that url, what do you get?

#

in your browser dev tools you can right click the failing network request and choose ot copy as curl, which you can paste in your command line

#

or import into postman or similar HTTP testing tool

stuck flax
#

how do i do it please

vale shore
#

It seems like that endpoint might not be running

#

I'm trying to explain that

#

If that URL is public, can you share it here?

stuck flax
#

It is public, but the error is stripe since it is its payment integration model.

#

how do you

vale shore
#

You're going to need to debug some more of this yourself, to be honest. We can certainly help guide you, but you need to be able to perform test requests and share logs from your PHP server to help investigate on your side.

#

My guess is that the webserver is not properly running the code to host the create.php endpoint, for some reason

stuck flax
#

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

#

ok thank for you help

vale shore
#

For example, when you put the PHP files on your server, did you ensure the stripe-php library was installed with composer like the guide you linked to suggested?

#

And you should double check how these files are being served, you need to ensure that the create.php endpoint is accessible/reachable for requests

stuck flax
#

Failed to load resource: the server responded with a status of 500 ()

#

last question and this error

vale shore
#

OK thats good! that means your server tried to do something and crashed! Crashes mean errors and we can fix errors. I would suggest seeing if you can access logs for the server, or add some logging, or simplify the endpoint and gradually add things back to get the Payment Intent creation.

#

Best guesses would be:

  • stripe library not installed
  • composer not set up to load the vendor init file correctly
  • incompatible PHP versions if the server is using an old PHP version