#danilo_dlr

1 messages ยท Page 1 of 1 (latest)

lavish citrusBOT
stable jewel
#

๐Ÿ‘‹ happy to help

frigid cedar
#

<?php
require_once '../stripe-php/init.php';
require_once('vendor/autoload.php');

\Stripe\Stripe::setApiKey('*********');

$customer_email = $_POST['email'];
$amount = $_POST['importe'];

$invoice = \Stripe\Invoice::create([
'customer_email' => $customer_email,
'amount' => $amount,
'currency' => 'usd',
]);

header("Location: " . $invoice->hostedInvoiceUrl);
exit();
?>

stable jewel
#

would you mind sharing the request ID?

frigid cedar
#

im not sending a request id on the invoice

#

maybe my code is wrong

#

maybe its because im not connecting properly to the SDK?

#

or a field is missing

#

idk

stable jewel
#

please read through the guide I sent you to learn how to retrieve one

lavish citrusBOT
frigid cedar
#

the API call didnt create a request, last request ID was req_y8rNKsLp8ZjhH6 day 21/04/2023

#

something is wrong on the code, its not generating a request properly

#

<?php
require_once '../stripe-php/init.php';
require_once('vendor/autoload.php');

\Stripe\Stripe::setApiKey('*');

$customer_email = $_POST['email'];
$amount = $_POST['importe'];

$invoice = \Stripe\Invoice::create([
'customer_email' => $customer_email,
'amount' => $amount,
'currency' => 'usd',
]);

header("Location: " . $invoice->hostedInvoiceUrl);
exit();
?>

#

the form we using its just sending the amount and customer email to the paystripe.php with the code above

#

HTTP ERROR 500 when sending the data to the php

abstract jungle
#

You need to debug your code (add some logs) in order to see why there are missing fields when creating the API request.. probably some fields are null/undefined

frigid cedar
#

i will check logs and make an update on this ticket soon

#

thanks

#

looks like autoload is not correctly refferenced:
Got error 'PHP message: PHP Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/vhosts/test.secure.unrwa.es/httpdocs/chile/paystripe.php on line 3PHP message: PHP Fatal error: require_once(): Failed opening required 'vendor/autoload.php' (include_path='.:/opt/plesk/php/7.4/share/pear') in /var/www/vhosts/test.secure.unrwa.es/httpdocs/chile/paystripe.php on line 3'

#

on server error_log

abstract jungle
frigid cedar
#

i used the code you provided me https://stripe.com/docs/invoicing/integration/quickstart?lang=php and added on the end of the server.php the following line: header("Location: " . $invoice->hostedInvoiceUrl);
to redirecto to the payment page. But when i send the payment the screen turn white, nothing showing, also on the webhook on the stripe dhasboard is not showing any API calls.
How can I continue to fix this problem?

#

i can send you the code if you want, to get a better understanding of my issue

abstract jungle
#

Try running that sample in a standalone project first and do an end to end test first

#

to redirecto to the payment page. But when i send the payment the screen turn white, nothing showing, also on the webhook on the stripe dhasboard is not showing any API calls.
Did you tried to access to the invoice hosting page from its url ?

frigid cedar
#

you mean just copy paste the sample? im not using composer i think the only change i need to do is deleting the autoloader and add the init.php file right?

abstract jungle
#

I'm not very familiar with PHP, but composer is the dependency manager, without composer what framework are you using for managin your php dependencies?

frigid cedar
stable jewel
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

frigid cedar
#

any updates?

stable jewel
#

I'm terribly terribly sorry

#

I missed that, and haven't taken a look

#

I sincerely appologize

stable jewel
frigid cedar
stable jewel