Package: credo-python
credo-pythonA python sdk for interacting with theCredo APIInstallationTo Install runpip install credo-pythonUsageBanks and Currenciesmethodsget_banksget_currenciesfromcredo.banks_and_currenciesimportBanksCurrenciesbanks_and_currs=BanksCurrencies(public_key='your-public-key',secret_key='your-secret-key')# gets list of all banksstatus,banks=banks_and_currs.get_banks()# print(banks)# [#     {#         "id": 1,#         "code": "044",#         "countryUuid": "nig45FDD-Jtr7-ygy7Df",#         "name": "Access Bank"#     },#     {#         "id": 18,#         "code": "032",#         "countryUuid": "nig45FDD-Jtr7-ygy7Df",#         "name": "Union Bank of Nigeria"#     }# ]status,currencies=banks_and_currs.get_currencies()# print(currencies)# [#   {'id': 1, 'code': 'USD', 'isDefault': 0, 'name': 'United States Dollars', 'symbol': '$'}, {'id': 2, 'code': 'NGN', 'isDefault': 1, 'name': 'Nigerian Naira', 'symbol': '?'})Customersmethodsaddupdatefetchfetch_allblacklistfetch_transactionsfromcredo.customersimportCustomerscustomers=Customers(public_key='your-public-key',secret_key='your-secret-key')# Adds a customerstatus,customer=customers.add(full_name='Random Name',email='rando.nam@gmail.com',phone_number='23480123456789',billing_address1='random ',billing_address2='random',district='random',state='random',facebook_username=None,instagram_username=None,twitter_username=None)# fetches all customers in your integrationstatus,customer=customers.fetch_all()# fetches the customer with the id passedstatus,customer=customers.fetch(141)# fetches all transactions for a customer whose ID is passedstatus,customer=customers.fetch_transactions(141)# blacklists the customer whose id is passedstatus,customer=customers.blacklist(141)Direct Chargemethodscharge_cardverify_cardthree_ds_chargefromcredo.direct_chargeimportDirectChargedirect_charge=DirectCharge(public_key='your-public-key',secret_key='your-secret-key')# Charge a card without 3DS verificationstatus,charge_card=direct_charge.charge_card(amount=2000,currency='NGN',card_number='5204730000001003',expiry_month="12",expiry_year="25",security_code="123",trans_ref="iy67f64hvc61",customer_email='random@mil.com',customer_phone="23480123456789",customer_name='Random',payment_slug="0H0UOEsawNjkIxgsporr")Standard Paymentmethodsinitiate_paymentverify_paymentfromcredo.paymentimportPaymentpayment=Payment(public_key='your-public-key',secret_key='your-secret-key')# to initiate a paymentstatus,new_payment=payment.initiate_payment(amount=3000,currency='NGN',customer_name='Random',customer_email='random@gmail.com',customer_phone='23480123456789',trans_ref='iy67f64hvc62',payment_options='CARD,BANK',redirect_url='https://github.com/BdVade/credo-python')# to verify a paymentstatus,verify_payment=payment.verify_payment(transaction_reference='iy67f64hvc62')Payment Linkmethodscreate_payment_linkget_payment_link_by_idupdate_payment_linkget_payment_link_by_slugpost_payment_link_transactionget_payment_link_transactionsget_payment_link_transaction_by_idget_customersfromcredo.payment_linkimportPaymentLink_link=PaymentLink(public_key='your-public-key',secret_key='your-secret-key')# create a payment linkpayment_link=_link.create_payment_link(name="Random",description="Random stuff",type_id=1,redirect_url='https://github.com/BdVade/credo-python',amount=3000,success_message="Thank you",phone_number='23480123456789',currencies="NGN",custom_fields=['Favourite food','Age'])# get a payment link by passing the payment slugstatus,link=_link.get_by_slug(link_slug='credo-random-2')# get a payment lik by passing the idstatus,link=_link.get_by_id(link_id=63)#get transactions made through payment linksstatus,transactions=_link.get_link_transactions()Transactionsmethodsallget_onerefundfromcredo.transactionsimportTransactionstransactions=Transactions(public_key='your-public-key',secret_key='your-secret-key')# To get a list of all your transactionsstatus,all_transactions=transactions.all()# To get a transaction by it's idstatus,transaction=transactions.get_one(transaction_id=5)# refund a transaction by its idstatus,refund=transactions.refund(transaction_id=5)Subaccountsmethodssubaccountscreate_subaccountget_subaccountupdate_subaccountfromcredo.subaccountsimportSubAccount_subaccounts=SubAccount(public_key='your-public-key',secret_key='your-secret-key')# get all subaccounts in your integrationstatus,subaccounts=_subaccounts.subaccounts()# get one subaccount by passing its idstatus,subaccount=_subaccounts.get_subaccount(subaccount_id=59)# create a new subaccountstatus,subaccount=_subaccounts.create_subaccount(account_name='Funds',account_number='0129322920',personal_account_name='Funds Money',verified=True,split_percentage=20,bank_id=6,currency_id=2)# update a sub accountstatus,subaccount=_subaccounts.update_subaccount(account_name='Fund',account_number='0129322920',personal_account_name='Funds Money',verified=True,split_percentage=20,bank_id=6,currency_id=2,subaccount_id=59)For more Information visit theCredo API documentation