#sergixel04
1 messages · Page 1 of 1 (latest)
Hello sergixel04, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• sergixel04, 17 hours ago, 53 messages
• sergixel04, 20 hours ago, 13 messages
• sergixel04, 3 days ago, 23 messages
• sergixel04, 6 days ago, 37 messages
• sergixel04, 6 days ago, 78 messages
Can you share the example subscription ID (sub_xxx)?
Of course!
sub_1O5kDQKYINwhn6n4FGnJq9g6
$createdSubscription = $stripe->subscriptions->create([
'customer' => $user->stripe_id,
'items' => [
['price' => $priceId]
],
'description' => 'Negocio extra: ' . $request->name,
]);
This is the code
I also have tested and tried 'automatic_tax' with enabled at true. But getting an error
{"error":"Received unknown parameter: automatic_tax[0]"}
automatic_tax is a hash, not an array.
The example code can be found here: https://stripe.com/docs/billing/taxes/collect-taxes?tax-calculation=stripe-tax#create-a-subscription
automatic_tax.enabled must set to true in order to use Stripe Tax
Do you plan to use Tax Rate (manually create tax rate yourself) or Stripe Tax (automatically calculated by Stripe)?
They are two different products
I think it would be Stripe Tax, when creating the prices at product, it automatically calculates the taxes correctly
In the first subscription I am using Stripe Checkout and that's fine.
But when I am using API for creating the subscription is charging the price without taxes
In the Subscription creation request https://dashboard.stripe.com/test/logs/req_dZx7YohMPGHJzY, automatic_tax.enabled: true wasn't set
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Without setting automatic_tax.enabled: true, there won't be automatic tax calculation
Yep, that test doesn't have that set up.
But the problem is I saw that parameter
and added to the code, like this:
$createdSubscription = $stripe->subscriptions->create([
'customer' => $user->stripe_id,
'items' => [
['price' => $priceId],
],
'automatic_tax' => [
['enabled' => true],
],
'description' => 'Negocio extra: ' . $request->n,
]);
But it's not creating the subscription, and it's catching this error
{"error":"Received unknown parameter: automatic_tax[0]"}
Have you checked the code example in https://stripe.com/docs/billing/taxes/collect-taxes?tax-calculation=stripe-tax#create-a-subscription ?
Your code has double square bracket under automatic_tax
It should just be:
'automatic_tax' => ['enabled' => true],
That worked, thank you so much, sorry for that mistake!