stripe / stripe-python

Python library for the Stripe API.
https://stripe.com
MIT License
1.64k stars 418 forks source link

TaxRate.list does not return any TaxRates, even when I can look them up with TaxRate.retrieve #1363

Closed AGPapa closed 1 month ago

AGPapa commented 1 month ago

Describe the bug

Calling stripe.TaxRate.list returns 0 records, however if I already have an id I can look it up with stripe.TaxRate.retrieve and get a valid record back.

To Reproduce

  1. Create an invoice (with automatic taxes from Stripe Tax enabled)
  2. Look up the tax_rate_id from that invoice using the invoice retrieve API (in the "total_tax_amounts" column)
  3. Call stripe.TaxRate.retrieve and see a valid response
  4. Call stripe.TaxRate.list and see that no tax rates are returned.

Expected behavior

If there is a valid tax rate that I can retrieve then I would expect it to appear in stripe.TaxRate.list

Code snippets

res = stripe.TaxRate.retrieve('txr_1PUrVyIO11dAjf9NNO46SkIF')

print(res) # This returns a valid record

res = stripe.TaxRate.list(limit=100)

print(res) # This does not

Response from TaxRates.retrieve

{
  "active": false,
  "country": "US",
  "created": 1719153334,
  "description": null,
  "display_name": "Sales Tax",
  "effective_percentage": 7.5,
  "id": "txr_1PUrVyIO11dAjf9NNO46SkIF",
  "inclusive": true,
  "jurisdiction": "Ohio",
  "jurisdiction_level": "multiple",
  "livemode": false,
  "metadata": {},
  "object": "tax_rate",
  "percentage": 7.5,
  "state": "OH",
  "tax_type": "sales_tax"
}

Response from TaxRates.list

{
  "data": [],
  "has_more": false,
  "object": "list",
  "url": "/v1/tax_rates"
}

OS

macOS

Language version

Python 3.12.4

Library version

10.1.0

API version

2024-04-10

Additional context

No response

remi-stripe commented 1 month ago

@AGPapa ithub issues are limited to bugs and feature requests with the SDK itself. This is more an integration support question about our API which is better directed at our support team: https://support.stripe.com/contact

To unblock you though I can explain the behaviour. Stripe Tax will create inline TaxRate that it uses to represent the tax information it calculates. Those TaxRates exist in the API and can be retrieved but they won't appear in the List TaxRates API because you didn't directly create them. We have this behavior on other APIs such as when you create an inline Price with price_data and it doesn't appear in the List Prices API. I hope this clarifies the issue but if you have any follow up question please work with our support team for further help: https://support.stripe.com/contact