Oops, something went wrong! Please ensure you have the correct URL and have not already paid this invoice.
";
require_once 'includes/guest_footer.php';
error_log("Stripe payment error - Invoice with ID $invoice_id not found or not eligible.");
exit();
}
$row = mysqli_fetch_assoc($sql);
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = escapeHtml($row['invoice_prefix']);
$invoice_number = intval($row['invoice_number']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
// Company info for currency formatting, etc
$sql_company = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
$company_row = mysqli_fetch_assoc($sql_company);
$company_locale = escapeHtml($company_row['company_locale']);
// Get client's Stripe customer ID
$stripe_customer_query = mysqli_query($mysqli, "
SELECT payment_provider_client FROM client_payment_provider
WHERE client_id = $client_id AND payment_provider_id = $stripe_provider_id
LIMIT 1
");
$stripe_customer = mysqli_fetch_assoc($stripe_customer_query);
$stripe_customer_id = $stripe_customer ? escapeSql($stripe_customer['payment_provider_client']) : null;
if (!$stripe_customer_id) { ?>
Setup Stripe payments for
In order to make online payments, please create a Stripe customer record for .
If you save payment details in future, you also grant consent for automatic payments.
Stripe customer record already exists.
";
echo "You can now proceed to pay your invoice.
";
echo "View Invoice";
}
} else {
exit("Error.");
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php';