May 6, 2016
0
Level 1
Stripe: Stripe\Customer instance: subscriptions / member function retrieve()
Hello.
I am trying to get Laravel and Stripe up and running. I have choosen to connect the subscription to the account, and not the user, as it fits my model.
'stripe' => [
'model' => App\Account::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET')
],
I have followed the howto on the Cashier-page. Creating a subscription (this is in Stripe's test-mode) works fine from Tinker, doing this:
\Stripe\Stripe::setApiKey(THE STRIPE API KEY);
\Stripe\Token::create(array("card" => array("number" => "4242424242424242","exp_month" => 1,"exp_year" => 2017,"cvc" => "314")));
$account->newSubscription('foo', 'bar')->create($creditCardToken);
The subscription is saved to the database, and visible in Stripes dashboard.
Then I try to increase the quantity of the subscription, this way:
$account = Account::find(1);
$account->subscription('ACT_USER_MONTH')->incrementQuantity(2);
That gives me these errors:
Stripe Notice: Undefined property of Stripe\Customer instance: subscriptions
Fatal error: Call to a member function retrieve() on null
I am not familiar enough with Laravel to figure out what I have done wrong.
Any help is appreciated :)
Please or to participate in this conversation.