laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.39k stars 679 forks source link

PDF invoice not showing tax percentage (Tax Rates) #854

Closed carlosten closed 4 years ago

carlosten commented 4 years ago

Description:

Created a subscription with the new taxRates() and the pdf invoice generated by Cashier is not showing any tax percentage. The subscription is correctly created in Stripe (with the proper Tax Rates).

Steps To Reproduce:

To generate the expected invoice I changed this property with $this->item->tax_amounts.

driesvints commented 4 years ago

We'll need some more info on how the tax rate and subscription set up as well as some code to reproduce the problem.

carlosten commented 4 years ago

Tax setup

Captura de pantalla 2020-01-19 a las 12 41 13

Subscription setup

Plan in € 10€ monthly charge No trial

Some code

Creating payment method:

public function create(Request $request)
{
    $user = Auth::user();
    $paymentMethod = $request->stripePaymentMethod;
    $user->createOrGetStripeCustomer();
    $user->addPaymentMethod($paymentMethod);

Creating subscription:

    $product_stripe_id = $request->product_stripe_id;
    $plan_stripe_id = $request->plan_stripe_id;

    $days = now()->diffInDays($user->trial_ends_at);     

    try {
        $subscription = $user->newSubscription($product_stripe_id, $plan_stripe_id)->trialDays($days)->create($paymentMethod, [
            'email' => $user->email,
        ]);
    } catch (IncompletePayment $exception) {
        return redirect()->route(
            'cashier.payment', [$exception->payment->id, 'redirect' => route('account')]
        );
    }
}

To get the invoices:

$user = Auth::user();
$invoices = $user->invoices();

In template: <td><a href="/user/invoice/{{ $invoice->id }}">Download</a></td>

Tax Rates

    public function taxRates()
    {
        return ["txr_1F***j"];
    }

Stripe invoice

This is how the Stripe invoice looks, with the taxes shown. The problem is only in the invoice generated by Cashier.

Captura de pantalla 2020-01-19 a las 12 37 39
driesvints commented 4 years ago

Thanks for the info. I probably won't have time to look into this until next week at the earliest.

driesvints commented 4 years ago

Managed to reproduce this. Will look into it.

driesvints commented 4 years ago

Sent in a PR for this: https://github.com/laravel/cashier/pull/876

driesvints commented 4 years ago

Fixed on master