#manuel_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1445817589983871068
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- manuel_api, 1 day ago, 28 messages
- manuel_subscription-pending-updates-delete, 1 day ago, 44 messages
hello! i'm taking a look at this now
i'm not super familiar with this error off the top of my head so i'm doing a bit of research now
i guess i know that what you're doing is not supported, but i am trying to figure out why which is always a little more challenging. then from there the question is how can we get you what you need or as close as possible to it
The idea is to add the tax when upgrading the subscription.
can you give me a little more context on the use case and why exactly you need to add it when upgrading? in the meantime i'm gonna set up a test script to experiment a little
I just need to know how to apply the tax without using the automatic_tax parameter.
Since some customers are not subject to tax...
also i tried to add the tax rate to every item inside the items param when im doing .modify() and got this req_vjs69i2PbqPM0b
and this one: req_7mL1YTVKCW4Rmt
i was able to add the default tax rate in a separate call from the one where you modify the items on the subscription and that works, but it feels hacky and i am still trying to figure out what potential negative outcomes there could be from that
i guess one downside would be that you would need to manually remove the tax rates if payment failed
also this is the body of the request:
stripe.Subscription.modify(
subscription.stripe_id,
items = items_stripe_modify,
payment_behavior = 'pending_if_incomplete',
proration_behavior = 'always_invoice',
)
It should be done within the same call of the api so that when the customer goes to pay, the taxes are included...
ok, i've dug into this a bit more and it does look like this is just not currently supported. if you did what i suggested and updated the subscription with the tax rate before adding the new prices, then the tax rates should apply to future invoices, but then you still have to do the work of un-doing the tax rates if payment fails, which basically negates the benefits of using pending_if_incomplete
so it's sounding to me like in its current state pending_if_incomplete won't work for this specific use case and you'll need to handle payment failures on your own
i do think that this is valid feedback i can pass along to our team to see if we can add support for this in the future, so i'll go ahead and make a note of this for them to see if we can prioritize supporting this in the future
Could you give me an example of how you did it using code? Please.
this one i mean: Could you give me an example of how you did it using code? Please.
yeah sure! this is in python and it include some wrapper functions i've built that handle test clock functionality for me, but it should give you the gist of it:
customer = create_test_clock_customer()
print(customer.id)
subscription = client.v1.subscriptions.create(params={
"customer": customer.id,
"items": [{"price": Prices().one_thousand_monthly()}],
})
print(subscription.id)
advance_clock(customer.test_clock, increment=1 * 60 * 60 * 24 * 15)
subscription = client.v1.subscriptions.update(subscription.id, params={
"default_tax_rates": ["txr_1SaJUHLFIO5qXQOW5iBSr2ht"],
})
subscription = client.v1.subscriptions.update(subscription.id, params={
"items": [{"price": Prices().two_thousand_monthly()}],
"payment_behavior": "pending_if_incomplete",
})
advance_clock(customer.test_clock, increment=1 * 60 * 60 * 24 * 16)```
just to be clear, i do not recommend going down this path because it basically negates the whole purpose of pending_if_incomplete as you'll need to handle payment failures somehow or another, but you're welcome to experiment with it
which version of the api are you using?
i cannot find that Subscription.update() in the documentation
And are there any other suggestions besides that? Since the idea is that when paying, the taxes are also applied to the items.
oh ok youre using the stripe client
im using the global config
I don't believe Stripe doesn't have a plan B for these cases.
So how can I apply taxes to my customers when they upgrade their subscription?
sorry for the delay - a few threads have cropped up so my responses might be a little slower
you should be able to just include the tax rate in the request to update the subscription, as long as you don't have "payment_behavior": "pending_if_incomplete"
is that not working for you either?
for example, this works just fine for me and results in the next invoice including the taxes
customer = create_test_clock_customer()
print(customer.id)
subscription = client.v1.subscriptions.create(params={
"customer": customer.id,
"items": [{"price": Prices().one_thousand_monthly()}],
})
print(subscription.id)
advance_clock(customer.test_clock, increment=1 * 60 * 60 * 24 * 15)
subscription = client.v1.subscriptions.update(subscription.id, params={
"items": [{"price": Prices().two_thousand_monthly()}],
"default_tax_rates": ["txr_1SaJUHLFIO5qXQOW5iBSr2ht"],
})
advance_clock(customer.test_clock, increment=1 * 60 * 60 * 24 * 16)
print(subscription.id)```