intval($balance_to_pay * 100), // Stripe expects cents 'currency' => $invoice_currency_code, 'description' => $pi_description, 'metadata' => [ 'itflow_client_id' => $client_id, 'itflow_client_name' => $client_name, 'itflow_invoice_number' => $invoice_prefix . $invoice_number, 'itflow_invoice_id' => $invoice_id, ], 'payment_method_types' => ['card'], ]); $output = [ 'clientSecret' => $paymentIntent->client_secret, ]; echo json_encode($output); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } exit; }