Questions tagged [laravel-cashier]

Laravel Cashier provides an expressive, fluent interface to Stripe's and Braintree's subscription billing services.

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription "quantities", cancellation grace periods, and even generate invoice PDFs.

Configuration

Composer

First, add the Cashier package to your composer.json file and run the composer update command:

"laravel/cashier": "~5.0" (For Stripe SDK ~2.0, and Stripe APIs on 2015-02-18 version and later)
"laravel/cashier": "~4.0" (For Stripe APIs on 2015-02-18 version and later)
"laravel/cashier": "~3.0" (For Stripe APIs up to and including 2015-02-16 version)

Service Provider

Next, register the Laravel\Cashier\CashierServiceProvider service provider in your app configuration file.

Migration

Before using Cashier, we'll need to add several columns to your database. Don't worry, you can use the cashier:table Artisan command to create a migration to add the necessary column. For example, to add the column to the users table run the command: php artisan cashier:table users.

Model Setup

Next, add the BillableTrait and appropriate date mutators to your model definition:

use Laravel\Cashier\Billable;
use Laravel\Cashier\Contracts\Billable as BillableContract;

class User extends Eloquent implements BillableContract {

    use Billable;

    protected $dates = ['trial_ends_at', 'subscription_ends_at'];

}

Adding the columns to your model's $dates property will instruct Eloquent to return the columns as Carbon / DateTime instances instead of raw strings.

Stripe Key

Finally, set your Stripe key in your services.php configuration file:

'stripe' => [
    'model'  => 'User',
    'secret' => env('STRIPE_API_SECRET'),
],

Reference

458 questions
0
votes
0 answers

Laravel Cashier - Stripe

I am developing application e-commerce application and using Laravel Cashier to charge the user. In some cases I have to refund partial amount. Is there is there any method to refund partial amount using Laravel Cashier. Thanks,
Faisal Ahsan
  • 928
  • 1
  • 12
  • 22
0
votes
1 answer

Laravel cashier do not set trial and ends date

I've just update my project to Laravel 5.2 and Cashier 6.0. I've followed the documentation and added the new subscriptions table but when I test it Cashier do not set the trial ends column. In my stripe plan I have 14 days of trial and in my stripe…
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
0
votes
1 answer

Is it possible to use Laravel Socialite and Laravel Cashier in the same application?

Is it possible to use Laravel Socialite and Laravel Cashier in the same Laravel 5.1 application? I have done many searches online and have found no examples of this being done, only others asking if it an be done as well and no answers. Has anyone…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
0
votes
1 answer

Swapping a subscription to different billing period with Laravel Cashier causes immediate charge

There is a case in which a user can swap from a monthly subscription to an annual subscription. This can be done using the following code: $company->subscription('annual') ->withCoupon($couponCode) ->swapAndInvoice(1); // 1 is the…
Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
0
votes
1 answer

How to add tax to Stripe subscription using Laravel Cashier (4.2)

I'd like to apply tax to the subscription I have just swapped the user to. Here is my attempt: protected function swapToYearlyPlan(){ $company = Auth::user()->company; $customer = $company->subscription()->getStripeCustomer(); …
Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
0
votes
0 answers

Laravel Cashier - adding a column that must be updated on subscription create, resume or cancel

I want to provide my users with the ability to lock in their rate for X number of years. However, this is not possible with Stripe API or Cashier. That is why I will have to do it on my application end. To do this I will need a subscribed_at column.…
Cristian
  • 2,390
  • 6
  • 27
  • 40
0
votes
1 answer

Metered billing with Laravel Cashier

I'm using Laravel 5's Cashier, and would like to add additional fees to a user's monthly bill. Stripe has this functionality available through their API: https://stripe.com/docs/subscriptions#metered-billing-and-one-time-charges However, it does…
Marty Thomas
  • 857
  • 2
  • 9
  • 18
0
votes
0 answers

Slow Stripe API response Laravel Cashier

I am using Laravel 5.0 and Laravel cashier ~5.0. I am having incredibly long response times from the Stripe API. I am running on a AWS EC2 in US EAST datacenter currently with 1GB RAM. The server has been setup by Forge with no HHVM. There is…
EddieP
  • 1
  • 1
  • 4
0
votes
1 answer

Stripe Subscription problems with Laravel 4.2

I have been using cashier to create subscriptions for a couple sites but when I tried to implement it again in an new app it's not working. I am getting Stripe Notice: Undefined property of Laravel\\Cashier\\Customer instance: default_card. Is there…
Wally Kolcz
  • 1,604
  • 3
  • 24
  • 45
0
votes
1 answer

Specifiy Stripe subscription start date using Laravel Cashier

I'm developing an application that uses Stripe, through Laravel Cashier to handle user subscriptions. When the user account is made, It has to be manually verified (has to be done this way due to the business logic) however the subscription starts…
TimothyBuktu
  • 2,016
  • 5
  • 21
  • 35
0
votes
1 answer

laravel 5 stripe error

Im using laravel 5 and cashier. Everything is working except for adding cards to a customer. So I'm missing something, i just don't know what. I get these 2 errrors: 1. Stripe Notice: Undefined property of Stripe_Customer instance: cards 2. PHP…
brandenwagner
  • 138
  • 1
  • 5
  • 20
-1
votes
2 answers

Delete all cards(sources) from stripe, Laravel stripe

Wanted to delete all the cards (sources) from the stripe account. Unable to find any API from documentation to delete the existing cards.
Priyanka Patel
  • 323
  • 4
  • 15
-1
votes
1 answer

How to hand over money in connect account to stripe account, Stripe Payment

I am using Connect Account in Stripe, to transfer money to members bank accounts in my project. Transfer is made once a month (on the 5th of each month). If a member withdraw from my site, I'd like to hand over the money of connect account to a…
bluestar0505
  • 338
  • 1
  • 14
-1
votes
2 answers

Can we change stripes keys in cashier dynamically in laravel 8?

I am using stripe with Laravel cashier. I want to make stripe keys dynamic instead of saving keys in .env file. I saved keys in database and now want to use these keys in cashier. Cashier get these keys from .env but i want to get these from…
-1
votes
1 answer

datetime issue when create a new subscription in Stripe - when subscription buyed from the users timezone

I am trying to create subscription in stripe through php sdk. subscription created successfully but here is the issue,When i create a subscription from UTC timezone my date is 2021-01-08 13:05:25 but in the dashboard subscription created in…
1 2 3
30
31