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
4
votes
4 answers

No such plan: monthly; one exists with a name of monthly, but its ID is primary Laravel Cashier

Getting this problem in Stripe test. Everything used to work in test, but when I created a new plan in Stripe, and deleted the original one, I now get the following error: No such plan: monthly; one exists with a name of monthly, but its ID is…
user3489502
  • 3,451
  • 9
  • 38
  • 66
4
votes
1 answer

Laravel: Integrate Braintree with Cashier

Just curious, Does someone has successfully integrated Braintree using laravel/cashier-braintree ? I'm stuck at the beginning with: $user->newSubscription('main', 'monthly')->create($creditCardToken); Following the documentation, I guess to need…
4
votes
5 answers

How to add coupon to *Stripe subscription* with Laravel Cashier after subscription already created

According to the Stripe documentation, it appears as though you can actually apply coupons to a customer as a whole, but you can also apply coupons to their subscriptions. I am trying to apply a coupon to the customer's subscription after the…
Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
3
votes
1 answer

Stripe Checkout One-Time Payments - Billing Portal does not show payment history/invoices

I am using Stripe and Billing Portal. If the user subscribes to a plan - after successful payment invoice.paid webhook event is triggered and it can be used to know if the payment was completed successfully. Also, when user visits Billing Portal -…
PeraMika
  • 3,539
  • 9
  • 38
  • 63
3
votes
1 answer

How to get all users whose subscriptions will expired today using Laravel Cashier

I am working on a application developed on Laravel/Vue having subscription payments on stripe, Currently I require users from stripe/Database whose subscriptions will expires today so that i set their status as expired in database, how can i get…
3
votes
2 answers

Laravel upgrade from 5.8 to laravel 6 - Call to undefined method Laravel\Cashier\Cashier::useCurrency()

I've just tried to upgrade from laravel 5.8 to laravel 6. Run composer update and got the following error in the console: Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1 …
adam78
  • 9,668
  • 24
  • 96
  • 207
3
votes
1 answer

Laravel Cashier 10 - Errors trying to show a Stripe element

I am using this tutorial to integrate Stripe into my Laravel site using Cashier: https://appdividend.com/2018/12/05/laravel-stripe-payment-gateway-integration-tutorial-with-example/ This tutorial was written for Cashier 9, so it does not work out of…
benpva16
  • 446
  • 6
  • 26
3
votes
0 answers

Resource missing error when adding payment method for subscription

Im using laravel cashier for stripe, im creating a subscription with no card up front and 15 days trial when user registration, im following laravel cashier tutorial to add payment method for user so card can be charged when trial is over but i keep…
Vishal Desai
  • 191
  • 3
  • 15
3
votes
3 answers

How to get transaction id after successful subscription

I am working on a platform offering services. When creating a new subscription, a new transaction for the first billing is created. How can I access the transactions id? I have a form with Braintree's Drop-in UI and my backend looks currently like…
Codearts
  • 2,816
  • 6
  • 32
  • 54
3
votes
0 answers

Laravel Cashier one subscription to all product plans

Stripe has recently released a new toolset called Billing. https://stripe.com/billing I have created a new product, of which there are 3 plans. I am able to use the Stripe SDK to create a single subscription to all 3 plans for the product. I would…
Sjshovan
  • 310
  • 2
  • 5
3
votes
1 answer

Laravel Cashier Without Subscription

I have following requirement. App user A calls another user B and if the user B attends the call, $1 has to be debited from his credit card. Card details will be collected during the registration step. There is no subscription involved in the…
Kiren S
  • 3,037
  • 7
  • 41
  • 69
3
votes
0 answers

Imposing limits based on Laravel Cashier plans

I was wondering if anyone has experience with imposing limits on features based on the user's current plan (using Cashier). For instance, let's say we have a netflix-like app that has 3 monthly…
mast
  • 167
  • 1
  • 10
3
votes
1 answer

Laravel Cashier Re-attempt Pending Invoice after Card Updates

I am using Laravel 5.3 with Cashier. If a customer updates their card details, how can I check if there is a pending invoice and ask Stripe to re-attempt the charge on the new card? At the moment, I have set the settings for attempts in Stripe…
Neel
  • 9,352
  • 23
  • 87
  • 128
3
votes
3 answers

Unable to set trial for subscription in Laravel Cashier 4.2 so that customer does not get charged right away

I'm currently using Laravel Cashier (4.2) with Stripe. The current Stripe API version I'm using is 2014-06-17. I have tried in various ways to set the trial end date when creating a subscription. I have tried all kinds of variations of this…
Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
3
votes
1 answer

How to simulate next Stripe billing cycle with Laravel Cashier

I want to see what happens when a user's next billing cycle fires to make sure that my GST calculations are correct. Maybe my terminology is wrong, but I can't seem to find any clear documentation for performing this action. Cheers.
Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
1 2
3
30 31