I want to dive into stripe and find out how to make payments.
I am using the cartalyst/stripe-laravel package to instantiate a new Stripe object like explained here.
Code should look like this:
$stripe = Stripe::make('your-stripe-api-key', 'your-stripe-api-version');
And indeed my code is the same:
public function chargeStripe()
{
// dd(Input::all());
// return env('STRIPE_PUBLIC_KEY');
// this is not my real secret test key
$stripe = Stripe::make('sk_test_IfJ649nAzKif3iOk0jj3XO5T', 'Version 101');
dd($stripe);
}
When die and dumping I get the error
RuntimeException in Config.php line 43:
The Stripe API key is not defined!
And this is what this Config.php says:
class Config extends Collection implements ConfigInterface
{
/**
* Constructor.
*
* @param string $version
* @param string $apiKey
* @param string $apiVersion
* @return void
* @throws \RuntimeException
*/
public function __construct($version, $apiKey, $apiVersion)
{
$api_key = $apiKey ?: getenv('STRIPE_API_KEY');
$api_version = $apiVersion ?: getenv('STRIPE_API_VERSION') ?: '2015-03-24';
if ( ! $api_key) {
throw new \RuntimeException('The Stripe API key is not defined!');
}
parent::__construct(compact('version', 'api_key', 'api_version'));
}
}
For some reason this method does not accept my arguments. Would be great if someone could give me a hint, what I am doing wrong. Thank you in advance.