3v4l.org

run code in 300+ PHP versions simultaneously
<?php require 'vendor/autoload.php'; \Stripe\Stripe::setApiKey('1eabb804c890012f0e98'); try { $customer = \Stripe\Customer::create([ 'email' => 'customer@example.com', 'name' => 'John Doe', 'source' => 'tok_visa' ]); $charge = \Stripe\Charge::create([ 'amount' => 1000, 'currency' => 'jpy', 'customer' => $customer->id, 'description' => 'Example charge' ]); echo "Charge successful! Charge ID: " . $charge->id; echo "Customer ID: " . $customer->id; } catch (\Stripe\Exception\ApiErrorException $e) { echo "Error: " . $e->getError()->message; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.20, 8.4.1 - 8.4.6
Warning: require(): open_basedir restriction in effect. File(vendor/autoload.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/GBdFo on line 2 Warning: require(vendor/autoload.php): Failed to open stream: Operation not permitted in /in/GBdFo on line 2 Fatal error: Uncaught Error: Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/GBdFo:2 Stack trace: #0 {main} thrown in /in/GBdFo on line 2
Process exited with code 255.

preferences:
54.14 ms | 407 KiB | 5 Q