php - In Laravel, how do I know what a customer is currently being billed? -


i'm using laravel 5 cashier package. have simple subscriptions ('standard' , 'pro') set up.

i need show how user being billed per year - subscriptions both annual.

i have handful of coupons user can use. so, how can show user being billed, taking account coupon may or may not have used?

i'd think $user->currentbillingprice might exist, or similar. i'd happy $user->invoice->latest->total, if such thing exists?

for still looking answer.

you have access stripe objects contain information you're looking for. here example of how information percentage coupons.

to subscription information (change 'main' use)...

$sub = $user->subscription('main')->asstripesubscription(); $plan = $sub->plan; $amount = $plan->amount; $percent_off = $sub->discount->coupon->percent_off; 

to user information (you can apply coupon user , applies invoices)

$stripe_user = $user->asstripeuser(); $percent_off = $stripe_user->discount->coupon->percent_off; 

Comments