'aiohttp async with stripe Django

I am learning Django and I am trying to use aiohttp but I am unable to figure how can I use it with stripe API calls.

This is my code:

class ListCardSerializer(serializers.Serializer):

pm = serializers.SerializerMethodField()

class Meta:
    model = Bill
    fields = ["pm"]

def get_pm(self, obj):
    stripe.api_key = settings.STRIPE_API_KEY
    cost = stripe.Customer.retrieve(customer_id)
    pm = stripe.Customer.list_payment_methods(
        customer_id, type="card"
    )
    return pm

I am new to Django any help will be appreciated. I am trying to convert my functions into async await.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source