pip install yoco-python
How to call the API using the Python SDK:
from yoco_python import YocoClient
# Instantiate the yoco client
yoco = YocoClient(
secret_key='YOUR_SECRET_KEY', # Replace with your Yoco secret key
charge_token='YOUR_CHARGE_TOKEN', # Replace with your token generated by the frontend API
amount_in_cents=1000, # The amount in cents to charge the user
currency='ZAR', # The currency of the amount
)
# Call the charge api
charge_response = yoco.charge()
# Call the refund api
if yoco.charge_success:
refund_response = yoco.refund()