mmohades / Venmo

Venmo API client for Python
GNU General Public License v3.0
145 stars 43 forks source link

Getting a KeyError: 'card' when attemptig to make a payment #19

Closed ammo414 closed 3 years ago

ammo414 commented 3 years ago

The following is the code I'm trying to run:

from venmo_api import Client

access_tok = Client.get_access_token('email', 'password', '2fa')
venmo = Client(access_token=access_tok)

venmo.payment.send_money(int, 'comment', 'recipientid')

venmo.log_out(access_tok)

The following is the traceback:

Traceback (most recent call last):
  File "payment.py", line 6, in <module>
    venmo.payment.send_money(int, 'comment', 'recipientid')
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/apis/payment_api.py", line 54, in send_money
    return self.__send_or_request_money(amount=amount,
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/apis/payment_api.py", line 122, in __send_or_request_money
    funding_source_id = self.get_default_payment_method().id
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/apis/payment_api.py", line 144, in get_default_payment_method
    payment_methods = self.get_payment_methods()
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/apis/payment_api.py", line 32, in get_payment_methods
    return deserialize(response=response, data_type=PaymentMethod)
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/utils/api_util.py", line 43, in deserialize
    return __get_objs_from_json_list(json_list=data, data_type=data_type)
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/utils/api_util.py", line 77, in __get_objs_from_json_list
    data_obj = data_type.from_json(obj)
  File "/home/USER/anaconda3/lib/python3.8/site-packages/venmo_api/models/payment_method.py", line 26, in from_json
    payment_class = payment_type[p_type]
KeyError: 'card'
mmohades commented 3 years ago

Thanks for opening an issue. This was caused by a card payment_method, that is currently not supported. It should be fixed in the new version. Update your venmo-api using pip3 install venmo-api --upgrade