Skip to main content

Python SDK for the YellowCard B2B API

Project description

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="USD")

# Get rates with conversion
rates = client.get_rates(currency="USD", convert="NG")

Collections

# Create a collection
collection = client.create_collection({
    "amount": 100.00,
    "currency": "USD"
    # Add other required fields
})

# 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]

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(
    partnerId="your_partner_id",
    currency="USD",
    amount=100.00,
    destination=Destination(
        accountNumber="1234567890",
        accountType=AccountType.BANK,
        accountName="John Doe"
    ),
    sender=Sender(
        name="Jane Doe",
        country="NG",
        email="jane@example.com"
    )
)

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="USD")

# Get rates with conversion
rates = client.get_rates(currency="USD", convert="NG")

Collections

# Create a collection
collection = client.create_collection({
    "amount": 100.00,
    "currency": "USD"
    # Add other required fields
})

# 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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yellowcard_business-0.1.17.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yellowcard_business-0.1.17-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file yellowcard_business-0.1.17.tar.gz.

File metadata

  • Download URL: yellowcard_business-0.1.17.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for yellowcard_business-0.1.17.tar.gz
Algorithm Hash digest
SHA256 64f152dd3bb279390b570de66b4ead1ff63ec7750e64ea13cbf5770ca231ba04
MD5 3b8cc70aa717824693b1e71e36972bb6
BLAKE2b-256 16cddbd97e12a0ab571ffe66bce6323cf8039cac11f0d205277f01ccab9f2c18

See more details on using hashes here.

File details

Details for the file yellowcard_business-0.1.17-py3-none-any.whl.

File metadata

File hashes

Hashes for yellowcard_business-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 feb8adf85c4e3b2dfd1a284fc43a2d3aefaa2319f42c6b97ca82cde8825ba421
MD5 4ececd4e0bcfaab848e91dae0fcc37b3
BLAKE2b-256 59891f6a4e6f6c666c3285e2a4f6a66bea746a64c634914f2caf10a6cb80488a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page