Move Money at the Speed of the Internet
Project description
zebedee-py
A python library that makes building with the ZBD API easy and fast. To sign-up for the ZBD API, use https://dashboard.zebedee.io .
To get started, you'll need to create a project using using the Developer Dashboard. Once you have a project, grab the API key from the API key tab. We will now assume that you have an API Key.
features
The Project class has all available endpoints for the ZBD API.
example usage
Install the package using:
pip install zebedee
Now you're ready to get started!
Here's example code.
from zebedee import *
# create a new ZBD object with callback URL to get updates after there is a status update.
project_a = zebedee.Project("your_api_key", "https://your-website.com/zbd/webhook/")
# Call the get_wallet_details function to retrieve your wallet details
wallet_details = project_a.get_wallet_details()
# Create a new charge for 1 hour with an amount of 5000 msats and a description
charge_details = project_a.create_charge(amount_of_seconds_to_expire_after=3600, amount_msats=5000, description='Test Charge')
# Get the details of a charge with the specified ZBD ID
charge_id = charge_details["id"]
charge_details = project_a.get_charge_details(charge_id)
# Create a new static charge with the specified parameters
static_charge_details = project_a.create_static_charge(allowed_slots=10, min_amount_msats=1000, max_amount_msats=10000, description='Test Static Charge', internal_id='123', success_message='Payment successful')
# Update the details of an existing static charge
static_charge_id = static_charge_details["id"]
updated_static_charge_details = project_a.update_static_charge_details(id=static_charge_id,allowed_slots=None, min_amount_msats=2000, max_amount_msats=20000, description='Updated Static Charge', success_message='Payment successful')
# Get the details of a static charge with the specified ZBD ID
static_charge_id = static_charge_details["id"]
static_charge_details = project_a.get_static_charge_details(static_charge_id)
# Create a new withdrawal request with the specified parameters
withdrawal_request_details = project_a.create_withdrawal_request(amount_of_seconds_to_expire_after=3600, amount_msats=10000, description='Test Withdrawal Request', internal_id='123')
# Get the details of a withdrawal request with the specified ZBD ID
withdrawal_request_id = withdrawal_request_details["id"]
withdrawal_request_details = project_a.get_withdrawal_request_details(withdrawal_request_id)
# Send a keysend payment to the specified public key with the specified amount and metadata
public_key = 'your_public_key_here'
amount_msats = 1000
metadata = {'key': 'value'}
payment_details = project_a.send_keysend_payment(public_key, amount_msats, metadata=metadata)
print(payment_details)
# Pay an invoice with the specified parameters
invoice = 'your_invoice_here'
description = 'Test Invoice Payment'
internal_id = '123'
payment_details = project_a.pay_invoice(invoice, description, internal_id)
# get payment details for a Zebedee payment with zbd_id=123
get_payment_details = project_a.get_payment_details(zbd_id=payment_details["id"])
# validate a lightning address
validate_lightning_address = project_a.validate_lightning_address(lightning_address="santos@zbd.gg")
# send a payment to a lightning address
payment_response = project_a.send_payment_to_lightning_address(
lightning_address="santos@zbd.gg", amount_msats=10000, comment="payment comment", internal_id="test:1"
)
# fetch a charge for a lightning address
charge_response = project_a.fetch_charge_from_lightning_address(
lightning_address="santos@zbd.gg", amount_msats=10000, description="charge description"
)
# send a payment to a gamertag
gamertag_payment_details = project_a.send_payment_to_gamertag(gamertag="santos", amount_msats=1000, description="payment description")
# get details for a gamertag transaction with zbd_id=123
transaction_details = project_a.get_gamertag_transaction_details(zbd_id=gamertag_payment_details["transactionId"])
# get the user ID associated with a gamertag
user_id = project_a.get_user_id_from_gamertag(gamertag="santos")
# get the gamertag associated with a user ID
gamertag = project_a.get_gamertag_from_user_id(user_id=user_id)
# fetch a charge for a gamertag
charge_response = project_a.fetch_charge_from_gamertag(
gamertag="santos", amount_msats=1000, description="charge description", internal_id="internal_id"
)
# check if an IP is in a supported region
supported = project_a.is_supported_region(ip="123.45.67.89")
# get the IP address of the ZBD production server
prod_server_ip = project_a.get_zbd_prod_server_ip()
# get the current BTC-USD exchange rate
btc_usd_price = project_a.get_btc_usd_quote_price()
# convert sats to msats -> returns 1000
amount_msats = project_a.convert_sats_to_msats(amount_sats=1)
# convert msats to sats -> returns 1
amount_sats = project_a.convert_msats_to_sats(amount_msats=1000)
# transfer funds between ZBD wallets
transfer_response = project_a.transfer_zbd_funds(amount_msats=1000, receiver_wallet_id="receiver_wallet_id")
best practices
- use an environmental variable for each apikey before going live with this code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zebedee-0.1.3.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file zebedee-0.1.3.tar.gz
.
File metadata
- Download URL: zebedee-0.1.3.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 192f7c99254346e433306da1d2ee5f472fa8ce82e4d1caa381442b34b57763b8 |
|
MD5 | 67e2b5d7fba7c5657fdacb7e27738b2b |
|
BLAKE2b-256 | b6bc0e3be8a6523152137c4e4cc71d9acb72557ea8dc3584d903677326b2ece6 |
File details
Details for the file zebedee-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: zebedee-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0e7fa13f5fb12dcaef906c4d4c8d96d31f21418eea3f5410263489ecd5d59fb |
|
MD5 | 05ab80aeb9ee6308a3b9cfb2f6fe4c78 |
|
BLAKE2b-256 | a84466ffcd9c9de678ede39c7bcc1791dde55b7823a263d4f5ae1a29483e2f32 |