stripe / stripe-python

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

calling stripe.treasury.Transaction.list Method raises Unrecognized request URL exception #1338

Closed pricetula closed 3 months ago

pricetula commented 3 months ago

Describe the bug

Calling the transaction list method to list payments raises an exception. This following documentation https://docs.stripe.com/api/treasury/transactions/list stripe.treasury.Transaction.list( financial_account="fa_.....", limit=3 )

To Reproduce

  1. set stripe.api_key stripe.api_key='sk_test_......'
  2. call the transaction list method stripe.treasury.Transaction.list( financial_account="fa_.....", limit=3 )
  3. exception raised stripe._error.InvalidRequestError: Request req_xxxxxxxxxx: Unrecognized request URL (GET: /v1/treasury/transactions). Please see https://stripe.com/docs or we can help at https://support.stripe.com/. (Hint: Have you onboarded to Treasury? You can learn more about the steps needed at https://stripe.com/docs/treasury/access)

Expected behavior

Expected the transaction list method to return a list of transaction objects

Code snippets

import stripe

stripe.api_key = 'sk_test_API_KEY'

def get_payments()
    return stripe.treasury.Transaction.list(
        financial_account="fa_ACCOUNT_ID",
        limit=3,
    )

OS

macOS

Language version

Python 3.12.3

Library version

stripe-python v9.8.0

API version

2024-04-10

Additional context

No response

remi-stripe commented 3 months ago

@pricetula That API requires being approved to use Treasury and access the APIs. Your account that you are testing with is likely missing some access and the best action would be to reach out to our support team for further help: https://support.stripe.com/contact