laravel-cashier

PHP Trait Override Protected Trait Method

青春壹個敷衍的年華 提交于 2019-12-11 06:35:32
问题 I am having problems with a composer package I am dealing with. It implements a trait Billable. trait Billable { /** * Update the payment method token for all of the user's subscriptions. * * @param string $token * @return void */ protected function updateSubscriptionsToPaymentMethod($token) { foreach ($this->subscriptions as $subscription) { if ($subscription->active()) { BraintreeSubscription::update($subscription->braintree_id, [ 'paymentMethodToken' => $token, ]); } } } } I am trying to

How to remove coupon from Stripe plan w/ Laravel Cashier 4

狂风中的少年 提交于 2019-12-10 23:43:08
问题 I am currently trying to implement a method that swaps people over to a new plan. The problem I am having is that the coupon from the old plan carries over and the user is not charged. Every time I try to remove the old coupon, it doesn't seem to allow it. protected function swapToYearlyPlan(){ $user = Auth::user(); // Tried this, doesn't work // $user->subscription()->retrieve($user->stripe_subscription)->deleteDiscount(); // This works fine $user->subscription('Gold Annual Plan')->swap(); /

Create plan on stripe through laravel

会有一股神秘感。 提交于 2019-12-04 20:34:56
问题 I want to create a plan from my application on stripe. The scenario is that users are charged with different prices as recurring payments. So, that is why I want to create plan for each user. I am using laravel 5 and using "laravel/cashier": "~5.0" 回答1: laravel/cashier just doesn't have this functionality baked in. You aren't out of luck though as it is easy to just use Stripe's API which should be downloaded as a dependency in your vendor folder. If not you can just download it with composer

Trouble setting up a subscription with Laravel 5.8 / Cashier / Stripe

倖福魔咒の 提交于 2019-12-04 13:23:43
问题 I followed this tutorial step by step: https://appdividend.com/2018/12/05/laravel-stripe-payment-gateway-integration-tutorial-with-example/ However, when I go to test it out, I get the following error: Stripe \ Error \ InvalidRequest No such payment_method: A couple of notes: I made sure that Stripe is in test mode, that my stripe API keys are set properly, and used the recommended testing card: 4242 4242 4242 4242 | 04/22 | 222 | 12345 I perused through the comments of the article, and see

Create plan on stripe through laravel

醉酒当歌 提交于 2019-12-03 13:47:43
I want to create a plan from my application on stripe. The scenario is that users are charged with different prices as recurring payments. So, that is why I want to create plan for each user. I am using laravel 5 and using "laravel/cashier": "~5.0" laravel/cashier just doesn't have this functionality baked in. You aren't out of luck though as it is easy to just use Stripe's API which should be downloaded as a dependency in your vendor folder. If not you can just download it with composer. composer require stripe/stripe-php 2.* You can use it with use \Stripe\Plan; Plan::create(array( "amount"