# 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](https://docs.zebedee.io/api/intro).
## 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.
Raw data
{
"_id": null,
"home_page": "",
"name": "zebedee",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,payments,bitcoin,lightning network,django,lightning",
"author": "zantoshi (Santos Hernandez)",
"author_email": "<santos@zebedee.io>",
"download_url": "https://files.pythonhosted.org/packages/b6/bc/0e3be8a6523152137c4e4cc71d9acb72557ea8dc3584d903677326b2ece6/zebedee-0.1.3.tar.gz",
"platform": null,
"description": "\n# zebedee-py\nA python library that makes building with the ZBD API easy and fast. To sign-up for the ZBD API, use https://dashboard.zebedee.io .\n\nTo 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.\n\n## features\nThe Project class has all available endpoints for the [ZBD API](https://docs.zebedee.io/api/intro). \n\n## example usage\nInstall the package using:\n`pip install zebedee`\n\nNow you're ready to get started!\n\nHere's example code.\n\n```\nfrom zebedee import *\n\n# create a new ZBD object with callback URL to get updates after there is a status update.\nproject_a = zebedee.Project(\"your_api_key\", \"https://your-website.com/zbd/webhook/\")\n\n# Call the get_wallet_details function to retrieve your wallet details\nwallet_details = project_a.get_wallet_details()\n\n# Create a new charge for 1 hour with an amount of 5000 msats and a description\ncharge_details = project_a.create_charge(amount_of_seconds_to_expire_after=3600, amount_msats=5000, description='Test Charge')\n\n# Get the details of a charge with the specified ZBD ID\ncharge_id = charge_details[\"id\"]\ncharge_details = project_a.get_charge_details(charge_id)\n\n# Create a new static charge with the specified parameters\nstatic_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')\n\n# Update the details of an existing static charge\nstatic_charge_id = static_charge_details[\"id\"]\nupdated_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')\n\n# Get the details of a static charge with the specified ZBD ID\nstatic_charge_id = static_charge_details[\"id\"]\nstatic_charge_details = project_a.get_static_charge_details(static_charge_id)\n\n# Create a new withdrawal request with the specified parameters\nwithdrawal_request_details = project_a.create_withdrawal_request(amount_of_seconds_to_expire_after=3600, amount_msats=10000, description='Test Withdrawal Request', internal_id='123')\n\n# Get the details of a withdrawal request with the specified ZBD ID\nwithdrawal_request_id = withdrawal_request_details[\"id\"]\nwithdrawal_request_details = project_a.get_withdrawal_request_details(withdrawal_request_id)\n\n# Send a keysend payment to the specified public key with the specified amount and metadata\npublic_key = 'your_public_key_here'\namount_msats = 1000\nmetadata = {'key': 'value'}\npayment_details = project_a.send_keysend_payment(public_key, amount_msats, metadata=metadata)\nprint(payment_details)\n\n# Pay an invoice with the specified parameters\ninvoice = 'your_invoice_here'\ndescription = 'Test Invoice Payment'\ninternal_id = '123'\npayment_details = project_a.pay_invoice(invoice, description, internal_id)\n\n# get payment details for a Zebedee payment with zbd_id=123\nget_payment_details = project_a.get_payment_details(zbd_id=payment_details[\"id\"])\n\n# validate a lightning address\nvalidate_lightning_address = project_a.validate_lightning_address(lightning_address=\"santos@zbd.gg\")\n\n# send a payment to a lightning address\npayment_response = project_a.send_payment_to_lightning_address(\n lightning_address=\"santos@zbd.gg\", amount_msats=10000, comment=\"payment comment\", internal_id=\"test:1\"\n)\n\n# fetch a charge for a lightning address\ncharge_response = project_a.fetch_charge_from_lightning_address(\n lightning_address=\"santos@zbd.gg\", amount_msats=10000, description=\"charge description\"\n)\n\n# send a payment to a gamertag\ngamertag_payment_details = project_a.send_payment_to_gamertag(gamertag=\"santos\", amount_msats=1000, description=\"payment description\")\n\n# get details for a gamertag transaction with zbd_id=123\ntransaction_details = project_a.get_gamertag_transaction_details(zbd_id=gamertag_payment_details[\"transactionId\"])\n\n# get the user ID associated with a gamertag\nuser_id = project_a.get_user_id_from_gamertag(gamertag=\"santos\")\n\n# get the gamertag associated with a user ID\ngamertag = project_a.get_gamertag_from_user_id(user_id=user_id)\n\n# fetch a charge for a gamertag\ncharge_response = project_a.fetch_charge_from_gamertag(\n gamertag=\"santos\", amount_msats=1000, description=\"charge description\", internal_id=\"internal_id\"\n)\n\n# check if an IP is in a supported region\nsupported = project_a.is_supported_region(ip=\"123.45.67.89\")\n\n# get the IP address of the ZBD production server\nprod_server_ip = project_a.get_zbd_prod_server_ip()\n\n# get the current BTC-USD exchange rate\nbtc_usd_price = project_a.get_btc_usd_quote_price()\n\n# convert sats to msats -> returns 1000\namount_msats = project_a.convert_sats_to_msats(amount_sats=1)\n\n# convert msats to sats -> returns 1\namount_sats = project_a.convert_msats_to_sats(amount_msats=1000)\n\n# transfer funds between ZBD wallets\ntransfer_response = project_a.transfer_zbd_funds(amount_msats=1000, receiver_wallet_id=\"receiver_wallet_id\")\n```\n\n## best practices\n\n- use an environmental variable for each apikey before going live with this code. \n",
"bugtrack_url": null,
"license": "",
"summary": "Move Money at the Speed of the Internet",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [
"python",
"payments",
"bitcoin",
"lightning network",
"django",
"lightning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a84466ffcd9c9de678ede39c7bcc1791dde55b7823a263d4f5ae1a29483e2f32",
"md5": "05ab80aeb9ee6308a3b9cfb2f6fe4c78",
"sha256": "f0e7fa13f5fb12dcaef906c4d4c8d96d31f21418eea3f5410263489ecd5d59fb"
},
"downloads": -1,
"filename": "zebedee-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "05ab80aeb9ee6308a3b9cfb2f6fe4c78",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5589,
"upload_time": "2023-08-19T18:51:07",
"upload_time_iso_8601": "2023-08-19T18:51:07.267744Z",
"url": "https://files.pythonhosted.org/packages/a8/44/66ffcd9c9de678ede39c7bcc1791dde55b7823a263d4f5ae1a29483e2f32/zebedee-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6bc0e3be8a6523152137c4e4cc71d9acb72557ea8dc3584d903677326b2ece6",
"md5": "67e2b5d7fba7c5657fdacb7e27738b2b",
"sha256": "192f7c99254346e433306da1d2ee5f472fa8ce82e4d1caa381442b34b57763b8"
},
"downloads": -1,
"filename": "zebedee-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "67e2b5d7fba7c5657fdacb7e27738b2b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5569,
"upload_time": "2023-08-19T18:51:08",
"upload_time_iso_8601": "2023-08-19T18:51:08.820314Z",
"url": "https://files.pythonhosted.org/packages/b6/bc/0e3be8a6523152137c4e4cc71d9acb72557ea8dc3584d903677326b2ece6/zebedee-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-19 18:51:08",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "zebedee"
}