credo-python
A python sdk for interacting with the Credo API
Installation
To Install run
pip install credo-python
Usage
Banks and Currencies
methods
- get_banks
- get_currencies
from credo.banks_and_currencies import BanksCurrencies
banks_and_currs = BanksCurrencies(public_key='your-public-key', secret_key='your-secret-key')
# gets list of all banks
status, 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': '?'})
Customers
methods
- add
- update
- fetch
- fetch_all
- blacklist
- fetch_transactions
from credo.customers import Customers
customers = Customers(public_key='your-public-key', secret_key='your-secret-key')
# Adds a customer
status, 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 integration
status, customer = customers.fetch_all()
# fetches the customer with the id passed
status, customer = customers.fetch(141)
# fetches all transactions for a customer whose ID is passed
status, customer = customers.fetch_transactions(141)
# blacklists the customer whose id is passed
status, customer = customers.blacklist(141)
Direct Charge
methods
- charge_card
- verify_card
- three_ds_charge
from credo.direct_charge import DirectCharge
direct_charge = DirectCharge(public_key='your-public-key', secret_key='your-secret-key')
# Charge a card without 3DS verification
status, 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 Payment
methods
- initiate_payment
- verify_payment
from credo.payment import Payment
payment = Payment(public_key='your-public-key', secret_key='your-secret-key')
# to initiate a payment
status, 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 payment
status, verify_payment = payment.verify_payment(transaction_reference='iy67f64hvc62')
Payment Link
methods
- create_payment_link
- get_payment_link_by_id
- update_payment_link
- get_payment_link_by_slug
- post_payment_link_transaction
- get_payment_link_transactions
- get_payment_link_transaction_by_id
- get_customers
from credo.payment_link import PaymentLink
_link = PaymentLink(public_key='your-public-key', secret_key='your-secret-key')
# create a payment link
payment_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 slug
status, link = _link.get_by_slug(link_slug='credo-random-2')
# get a payment lik by passing the id
status, link = _link.get_by_id(link_id=63)
#get transactions made through payment links
status, transactions = _link.get_link_transactions()
Transactions
methods
- all
- get_one
- refund
from credo.transactions import Transactions
transactions = Transactions(public_key='your-public-key', secret_key='your-secret-key')
# To get a list of all your transactions
status, all_transactions = transactions.all()
# To get a transaction by it's id
status, transaction = transactions.get_one(transaction_id=5)
# refund a transaction by its id
status, refund = transactions.refund(transaction_id=5)
Subaccounts
methods
- subaccounts
- create_subaccount
- get_subaccount
- update_subaccount
from credo.subaccounts import SubAccount
_subaccounts = SubAccount(public_key='your-public-key', secret_key='your-secret-key')
# get all subaccounts in your integration
status, subaccounts = _subaccounts.subaccounts()
# get one subaccount by passing its id
status, subaccount = _subaccounts.get_subaccount(subaccount_id=59)
# create a new subaccount
status, 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 account
status, 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 the Credo API documentation
Metadata
Release files for credo-python 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| credo-python-1.0.1.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| credo_python-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / credo-python-1.0.1.tar.gz
| Download URL | credo-python-1.0.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9f75f4c067491c582cbd8e4cbf39b3148aabf71094472e499e1afebb98ac5a6
|
|
BLAKE2b-256 checksum How to use checksums |
9a539d6f3770505c466f9036b1b6dc94bfe938fb42ba987bb47e4901cfbd9dec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9
|
Release files / credo_python-1.0.1-py3-none-any.whl
| Download URL | credo_python-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
841d96f9a48e866acc8593d442124b42e921cf6586c746e35e67cd19fc18afbf
|
|
BLAKE2b-256 checksum How to use checksums |
136dc9253473f04ea4c42ed0ed9ef29fe9f434a430f6e450682bbee9051b138c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9
|
Security for credo-python 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.