Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get customer balance transactions? #1785

Open
BoPeng opened this issue Aug 19, 2022 · 2 comments
Open

How do I get customer balance transactions? #1785

BoPeng opened this issue Aug 19, 2022 · 2 comments
Assignees
Labels
question How To or Usage questions
Milestone

Comments

@BoPeng
Copy link

BoPeng commented Aug 19, 2022

What are you trying to accomplish?

List all balance transactions related to a customer, potentially within a specified time frame.

Potential solutions

Querying BalanceTransaction database is not easy since there is no customer field for this class. This class does have a source, but this is not a ForeignKey so I cannot query by something like source.customer.id = request.user.customer.id. It is possible to check BalanceTransaction.get_source_instance().customer after retrieving all transactions, but that would be very inefficient.

Stripe provides an API for list customer balance transaction, which returns a list of balance transactions. However, using this API means that I will have to query stripe directly, ignoring all BalanceTransactions that are already available locally.

Perhaps dj-stripe can provide a function Customer.list_balance_transactions?

@BoPeng BoPeng added the question How To or Usage questions label Aug 19, 2022
@arnav13081994 arnav13081994 self-assigned this Aug 22, 2022
@arnav13081994
Copy link
Collaborator

@BoPeng We currently do not support the Customer Balance Transaction model. It may be added in the future but I cannot guarantee that.

@arnav13081994 arnav13081994 added this to the 3.0.0 milestone Aug 22, 2022
@BoPeng
Copy link
Author

BoPeng commented Aug 22, 2022

Thanks for your quick reply. I will use stripe.Customer.list_balance_transactions directly for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question How To or Usage questions
Projects
None yet
Development

No branches or pull requests

2 participants