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
6
votes
1 answer

Retrieve list of subscription plans from stripe with Laravel 5.4

How to obtain a list of subscription plans from stripe with Laravel 5.4? Is there even a way to retrieve a list of subscription plans? the following checks if a user is subscribed to a plan @if(Auth::user()->subscribed('dailyTest')) but is there…
The-WebGuy
  • 877
  • 5
  • 12
  • 25
5
votes
2 answers

Retrieve the price for Product from stripe using laravel Cashier

Suppose i have created a product on stripe with API ID "price_1IYwYtA4vM4p6MlHCuiAZx9X" of cost $25.00USD So how can we retrieve the cost of this product using API id using laravel cashier?
5
votes
2 answers

Laravel & Stripe - Unrecognized request URL (GET: /v1/customers/)

I got this error message when trying to add a new subscription using Laravel Cashier. Unrecognized request URL (GET: /v1/customers/). If you are trying to list objects, remove the trailing slash. If you are trying to retrieve an object, make sure…
Nurdin
  • 23,382
  • 43
  • 130
  • 308
5
votes
1 answer

Laravel Cashier auto send email on invoice / receipt

On Stripe document / Laravel cashier it says it can send email automatically after invoice was created. I tried to switch the settings related on that on Stripe's settings menu, but I am not receiving any email after I purchase or subscribe. Do I…
mpalencia
  • 5,481
  • 4
  • 45
  • 59
5
votes
6 answers

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

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…
John Hubler
  • 877
  • 1
  • 11
  • 27
5
votes
0 answers

Laravel cashier list all invoices and total

I have a subscription platform with Laravel Cashier and Stripe. I am trying to create an admin backend where the Admin can see all subscription payments made and also the total amount the site has generated in subscriptions. I was able to roughly…
Alex
  • 193
  • 1
  • 2
  • 12
5
votes
0 answers

Stripe subscription with extra features (modules or addons)

I need to make a change to my current subscription system and I need to add the option for users to be charged on a subscription basis based on the features (modules) they want. Here's an example: BasePlan1_2015: $10 Feature1: $5 Feature2:…
Cristian
  • 2,390
  • 6
  • 27
  • 40
5
votes
2 answers

Unable to generate a Cashier PDF in Laravel

I am using Laravel 5 to generate a PDF from a subscription generated from Cashier. The docs say this is as simple as calling: return $user->downloadInvoice($invoice->id, [ 'vendor' => 'Your Company', 'product' => 'Your…
Mike
  • 8,767
  • 8
  • 49
  • 103
4
votes
0 answers

Laravel Cashier + Can you customize the additonal field for a subscription

I have a question while using laravel cashier with stripe, can you customize stripes additional fields to a field that is not supplied by stripe. Like if i wanted to customize stripe table and add my own field is that possible? Just to test i added…
jmike
  • 471
  • 1
  • 7
  • 19
4
votes
1 answer

Laravel Cashier subscriptions table

First time user of Laravel Cashier (version 11 and Laravel v6.x). There are two tables provided part of the standard migration of Cashier; subscriptions and subscription_items. I just wanted to understand clearly what is the purpose of the…
user2268244
  • 244
  • 1
  • 15
4
votes
2 answers

Laravel Cashier - Unit Tests with creating subscriptions with payment methods

Looking deeper into this, I'm not sure it's even possible, which is a shame because I'm trying to learn TDD. I would like to test my model with Billable being created and subscribed to a plan. /** @test */ public function…
good_afternoon
  • 1,529
  • 1
  • 12
  • 41
4
votes
1 answer

Laravel Cashier 3D Secure/SCA issue stripe

After integrating the stripe system using laravel cashier in our website, I did the testing with the test cards, few cards were successful and few were not. I have tried to adapt to the 3D secure/ SCA. So the thing is, 4000003800000446,…
4
votes
2 answers

Laravel - How to retrieve all subscriptions with metadata from Stripe

I am creating a Stripe subscription with Laravel cashier. I have successfully created a subscription in Stripe with metadata. How to retrieve all subscriptions (with metadata) of a customer.? Below is the code that creates the…
mujuonly
  • 11,370
  • 5
  • 45
  • 75
4
votes
3 answers

Laravel Cashier + Stripe: No Such Customer

I am working on developing a subscription for a web application using Laravel Cashier and Stripe. I'm using Stripe v3 JavaScript API and using the card elements to generate the Stripe token. The Stripe token is being generated, and if you look in…
Aaron
  • 757
  • 5
  • 18
1
2
3
30 31