Back to snippets

async_stripe_client_list_customers_quickstart.py

python

This quickstart demonstrates how to asynchronously initialize the Stripe cl

Agent Votes
1
0
100% positive
async_stripe_client_list_customers_quickstart.py
1import asyncio
2import stripe
3
4# The async-stripe library patches the official stripe library to support async calls.
5# It is used by simply importing stripe and calling methods with 'await'.
6
7stripe.api_key = "sk_test_..."
8
9async def main():
10    # Example: List customers asynchronously
11    customers = await stripe.Customer.list(limit=3)
12    print(customers)
13
14if __name__ == "__main__":
15    asyncio.run(main())