What does CurlClient.php look like?
May 7, 2016
4
Level 4
Cashier Stripe "Call to Undefined Function Stripe\HttpClient\curl_init()"
I'm getting the following error when I try to charge a monthly subscription:
FatalErrorException in CurlClient.php line 55:
Call to undefined function Stripe\HttpClient\curl_init()
So What I've got is this (Just for testing purposes I have this in Route.php, but once things are moving I will move the code elsewhere:
Route::post('charge', function(){
$creditCardToken = Input::get('stripeToken');
$user = User::find(Auth::user()->id);
$user->newSubscription('pro', 'pro')->create($creditCardToken);
return 'MONEY';
}
For composer I have:
"laravel/cashier": "~6.0",
I did register service provider already. I'm running on ubuntu so I've already tried the following:
sudo apt-get install php5-curl
I'm not 100% certain if this is how I'm supposed to do it but my User model looks like this:
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Laravel\Cashier\Billable;
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword, Billable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
My config/app:
Laravel\Cashier\CashierServiceProvider::class,
My config/services:
'stripe' => [
'model' => App\User::class,
'key' => 'TEST_PUBLISHABLE_KEY_GOES_HERE',
'secret' => env('STRIPE_SECRET'),
],
My .env:
STRIPE_SECRET=TEST_SECRET_KEY_GOES_HERE
And I'm not sure how to go about solving this issue. Can someone help me through this please!
Please or to participate in this conversation.