Closed roman-briazgalov closed 3 years ago
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
Hi, @driesvints
Thanks for your reply! I hope it could be here because Cashier stopped working properly after upgrade. I decided to post it here exactly because of this.
Let me explain in details:
So i have decided that it could be bug.
I have noticed one more weird thing: In Laravel Cashier docs we see that if we use the second argument in the newSubscription() as the string, we have to get the usual subscription:
$request->user()->newSubscription(
'default', 'price_premium'
)->create($request->paymentMethodId);
If we use the second argument as the array, we will get the multiple subscription:
$request->user()->newSubscription('default', [
'price_monthly',
'chat-plan',
])->create($request->paymentMethodId);
I have checked my code. I use string, but in result i have the multiple subscription. It is not OK, right?
Description:
I used Laravel framework, Cashier, MongoDB and Jenssegers/laravel-mongodb. But after this reply i have changed database to MySQL for tables users, subscriptions and subscription_items. My app was working well. But after i have updated Laravel Framework from 6 to 8 and Cashier (stripe) from 10 to 12 cancellation of the subscription stopped working. I have error:
It looks like the Cashier wants to work with model Subscription of old type (where the field 'stripe_id' existed and wasn't empty, all information about subscription is saved in one table 'subscription'). But the new subscription was made like the multiple subscription, i mean information about subscription is saved in two tables: 'subscriptions' and 'subscription_items'.
If we check the trace of error, we see that here 'vendor/stripe/stripe-php/lib/ApiResource.php:104' is the problem:
$this['id'] return null, because there is no 'stripe_id' in subscription object. It has to use table subscription_items and stripe ID inside this table.
I have doublechecked upgrade guides for Laravel and Cashier but could not find anything that could help me.
Could you please show where is the mistake in my part or fix the problem in the lib?