YellowCard Business SDK
A Python SDK for integrating with the YellowCard B2B API. This SDK provides a simple interface to interact with YellowCard's payment and collection services.
Installation
Install the package using pip:
pip install yellowcard_business
Getting Started
To use the SDK, you'll need your API key and secret key from YellowCard. You can initialize the client as follows:
from yellowcard_business import YellowCard
# Initialize the client
client = YellowCard(
api_key='your_api_key',
secret_key='your_secret_key',
env='sandbox' # Use 'production' for live environment
)
Features
Payments
Create a Payment
from yellowcard_business.models import CreatePaymentRequest, Sender, Destination, AccountType
payment_data = CreatePaymentRequest(
channelId="fe8f4989-3bf6-41ca-9621-ffe2bc127569",
reason="bills",
sequenceId="unique-uuid",
sender=Sender(name="Python SDK", email="john@example.com", country="NG", address="test", dob="1990-01-01",
idNumber="1234567890", idType="test"),
destination=Destination(
accountNumber="1234567890",
accountType="bank",
accountName="Python SDK",
networkId="fa316206-dacc-4e87-a80a-5f539a719c56"
),
amount=10,
forceAccept=False,
directSettlement=False
)
payment = client.create_payment(payment_data)
Get Payment Details
payment = client.get_payment("payment_id")
Accept/Deny Payment
# Accept a payment
accepted_payment = client.accept_payment("payment_id")
# Deny a payment
denied_payment = client.deny_payment("payment_id")
Channels and Networks
Get Available Channels
# Get all channels
channels = client.get_channels()
# Get channels for a specific country
channels = client.get_channels(country="NG")
Get Networks
# Get all networks
networks = client.get_networks()
# Get networks for a specific country and channel
networks = client.get_networks(country="NG", channel_id="channel_id")
Rates
# Get all rates
rates = client.get_rates()
# Get rates for a specific currency
rates = client.get_rates(currency="ZAR")
# Get rates with conversion
rates = client.get_rates(currency="ZAR", convert="NG")
Collections
# Create a collection
from yellowcard_business.models import CreateCollectionRequest, Recipient, Destination, AccountType
collection_request = CreateCollectionRequest(
channelId="af944f0c-ba70-47c7-86dc-1bad5a6ab4e4", # deposit channel
reason="other",
sequenceId="uuid",
recipient=Recipient(
name="Python SDK",
email="john@example.com",
country="NG",
address="test",
dob="1990-01-01",
idNumber="1234567890",
idType="test",
phone="+2348090909090"
),
source=Destination(
accountNumber="1234567890",
accountType=AccountType.BANK,
accountName="Python SDK",
networkId="fa316206-dacc-4e87-a80a-5f539a719c56"
),
amount=10,
forceAccept=False,
directSettlement=False
)
collection = client.create_collection(collection_request)
# Get collection details
collection = client.get_collection("collection_id")
# Accept a collection
client.accept_collection("collection_id")
# Deny a collection
client.deny_collection("collection_id")
Error Handling
The SDK will raise exceptions when API calls fail. It's recommended to wrap API calls in try-except blocks:
try:
payment = client.get_payment("payment_id")
except Exception as e:
print(f"An error occurred: {str(e)}")
Support
For support and more information about the YellowCard B2B API, please contact our support team or visit our documentation.
License
[Add your license information here]
Metadata
Release files for yellowcard-business 0.1.21
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 | |
|---|---|---|---|---|
| yellowcard_business-0.1.21.tar.gz | 9.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yellowcard_business-0.1.21-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / yellowcard_business-0.1.21.tar.gz
| Download URL | yellowcard_business-0.1.21.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c88a60744fd1a5f3052546a39c07272dac78014530d9ac5d92bb7853efdceae
|
|
BLAKE2b-256 checksum How to use checksums |
bb70cf22ee4510841898e34bf16b839264f5d7094e0da57a946a63787d1f70a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.6
|
Release files / yellowcard_business-0.1.21-py3-none-any.whl
| Download URL | yellowcard_business-0.1.21-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f11c48959cce74dfb2b5b78c85a0eb42b5ec7907e442fddad94ff24d7e16a4e8
|
|
BLAKE2b-256 checksum How to use checksums |
2e0c7d04a544285f4d24d46feee8e0215f5bf485f577e5d987482b7120312ad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.6
|
Security for yellowcard-business 0.1.21
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.