#hamidm-preview-tax
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Moving the questions in this thread for full context
How can I preview tax amount for a given subscription before incrementing the quantity (purchase new seats logic) with Stripe Api and the next question is how to preview the tax amount before user subscribes (no customer yet), basically on checkout where the customer has selected the price and has the quantity for the subscription also with Stripe Api? Thank you
thanks for your patience
have you tried using upcoming invoice API endpoint already?
https://stripe.com/docs/api/invoices/upcoming
It is useful to preview changes to a subscription
We have a doc here that shows an example
https://stripe.com/docs/billing/subscriptions/prorations#preview-proration
Hi, yes we are already using upcoming invoice endpoint to get the prorated amount based on subscription quantity, but the problem is that don't know how to preview the tax for that prorated amount
So far this is the payload that we are using to preview the tax before the customer subscribes - no customer created to Stripe yet:
$payload = [
'automatic_tax' => ['enabled' => true],
'customer_details' => [
'address' => [
'city' => $city,
'state' => $state,
'country' => 'US',
'postal_code' => $zip,
'line1' => $address
],
],
'expand' => [
'total_tax_amounts.tax_rate'
],
'subscription_items' => [
['price' => $price, 'quantity' => $quantity]
]
];
$upcomingInvoice = Invoice::upcoming($payload);