i am using cashier 10 and stripe 7 and i am creating monthly, yearly and life time subscription.
Montlhy and Yealry subscription is working fine but life time charge generate error
The provided PaymentMethod is already attached to another object. You cannot reuse PaymentMethods without attaching them to a Customer object first.
in controller
$user->charge((int)$request->plan_price*100, $request->paymentMethod);
Related
i'm building an app with multiple subscriptions plan for my users.
Let's say my user as a 'free' plan, and want to upgrade to a 'pro' plan.I'm using stripe customer billing portal, which work perfectly.
But when i want to downgrade, i would like the plan to change only a the subscription period end, unfortunately, it's change immediatly.
I know i can handle it from API, but i need to do it from the customer portal generated by stripe.
Any idea how to configure my stripe customer portal to handle downgrade this way ?
i would like the plan to change only a the subscription period end, unfortunately, it's change immediately.
This is not completely supported with Subscriptions and the Customer Portal. Any change you make to the Subscription's SubscriptionItems is immediate, e.g. changing from price_123 to price_678 happens the moment you update the Subscription.
However, using the proration_behavior: 'none' parameter on a CustomerPortal Configuration, you can configure it to not create prorations or invoice the Customer immediately but instead, defer the new payment amount on to the next Invoice.
I recently increased the prices of my Stripe subscription plans on my Laravel SASS application. Now, when a user cancels their subscription, it throws the following error:
"The subscription is managed by the subscription schedule sub_sched_XXXXXXXXXX, and updating any cancelation behavior directly is not allowed. Please update the schedule instead."
I'm using Laravel 5.6 and have this in my composer.json file:
"laravel/cashier": "~7.0",
Basically, I get the subscription object and just call cancel(). E.g.:
$subscription->cancel();
This worked for years until I recently changed my prices. Is this a programming error on my part, or do I need to move my subscription plans off of schedules somehow? I'm really stumped here, because Googling has not turned up any useful results on this error.
Found the issue. The recent price change moved the subscriptions onto a schedule. I had to release the subscription schedule using the API here:
https://stripe.com/docs/api/subscription_schedules/release?lang=php
I cannot find the answer to this question that I once found. Basically I was able to create a stripe subscription using Laravel Cashier, and then trigger via code the subscription to be billed again, so I could test my invoice succeeded webhook. I am using Laravel Cashier. I recall I used ngrok to proxy, so I could get my webhook to work.
Basically it is recharging an active subscription. Any help would be great. PHP preferably.
The best option for now is to create a Subscription with a short trial period of a few minutes using the trial_end parameter. This lets you create a Subscription that will renew a few minutes later to simulate a new period that is starting.
There is no way to "fast forward time" or similar to go through multiple cycles in a few minutes otherwise.
As for webhooks the best option is to use Stripe's CLI: https://stripe.com/docs/stripe-cli
I am using Laravel Cashier to add stripe payments (subscriptions) for the premium version of my web app. Users are offered a 5-day free trial (card in advance).
Now what happens is, I create a subscription using:
$user->newSubscription('premium','monthly')->trialDays(5)->create($stripeToken,['email' => $user->email], "")
Works really well, but let's say the user cancels his subscription within the trial period.. He will be on the 'grace' period, let's say for 4 more days..
When these days are passed, user will lose account benefits, as the trial will expire and subscription is cancelled.
But, after that, if the user wants to subscribe again, since $subscription->resume() is only available during the grace period, I would have to create a subscription using $user->newSubscription, generating a new subscription on the table and a new trial period.. allowing them to cancel again, wait 5 days, create another one and repeat this getting free trial days forever..
Is there a way to "resume" an existing subscription when it is cancelled and grace period is over?
I am using Stripe SDK with PHP Laravel 5.1. I am receiving payment from registered user of certain type. Upon certain steps I'd like to transfer a certain amount of their payment to other users who already added their cards in Stripe. How can I do that?
Right now I m only asking his Credit Card Info and storing in Card object. Should I need to ask his bank account information as well?