Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carlosten opened this issue Jan 17, 2020 · 6 comments
Closed

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

carlosten opened this issue Jan 17, 2020 · 6 comments
Labels
Milestone

Comments

@carlosten
Copy link

  • Cashier Version: Master branch - f8b02e5
  • Laravel Version: 6.9.0

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:

  • Configure stripe:
    • Subscription
    • Tax Rate
  • Use cashier to Subscribe one user to the subscription adding a tax rate using taxRates()
  • Generate a PDF invoice using Cashier

Expected:

  • The generated invoice includes the taxes percentage.

Captura de pantalla 2020-01-17 a las 15 20 08

Result:

  • The generated invoice only shows the payment done by the user.

Captura de pantalla 2020-01-17 a las 15 21 08

Remarks:

In cashier/src/InvoiceLineItem.php line 135, $this->item->tax_rates is empty when generating the invoice.

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

@carlosten carlosten mentioned this issue Jan 17, 2020
3 tasks
@driesvints
Copy link
Member

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
Copy link
Author

carlosten commented Jan 19, 2020

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
Copy link
Member

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

@driesvints driesvints added this to the v11 milestone Feb 3, 2020
@driesvints
Copy link
Member

Managed to reproduce this. Will look into it.

@driesvints
Copy link
Member

Sent in a PR for this: #876

@driesvints
Copy link
Member

Fixed on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants