BantuPay SDK
Project description
BantuPay SDK
Installation
Using pip to include bantupay-sdk in your own project:
$ pip install bantupay-sdk
Getting started
Use the following code to create key pair.
from bantupay_sdk import account
keyPair = account() # keyPair will now contain this structure {secret: '', publicKey: ''}
Use the folowing code to sign http data
from bantupay_sdk import signHttp
httpSign = signHttp(
uri='/v2/user/',
body='{username: "proxie"}',
secretKey'SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI'
); # Secret key gotten from the create account method.
Use this to Sign a transaction
from bantupay_sdk import signTxn
signTxn = bantuSDK.signTxn(
secretKey="SDBG73M4LPCPCQ6NQ4CP4LCF7MOOQGUFJRRBD26P6QKIHW2ESP5R7DDN",
transactionXDR="AAAAAOKtdgWGQ02FzacmAD1WhAhI5Dp7kPRojOGjNQj3FBWvAAAAZAAcmBgAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAANQmFudHUuTmV0d29yawAAAAAAAAAAAAAAAAAAAA==",
networkPhrase="Bantu Testnet"
);
To make payment
The expressPay method is designed for making payments from bots or any other API like bulk payment engines, that does not need any userfeedback
from bantupay_sdk import expressPay
# Example for making XBN payment
# Please NOTE: - if you are making payment to Bantu's naitive assest you MUST leave assetCode and assetIssuer empty, your request will look like this.
expressPay(
username="proxie",
destination="long",
memo="Test 0",
amount="1",
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
)
# Let's make a BNR payment
# for mainnet, BNR issuer is GARO4SCJCPO4QPW27EZQBDV5KY4GXXBH6FOLUQ73K73VC4NP5PGBANTU,
# for testnet BNR issuer is GBNRQ56XX4JA3HKXP7EACLLXYPHCYCWBWOQZYSPGUIJSR5JSAD22EZXG
# Please ensure that you use the right issuer
expressPay(
username="proxie",
destination="long",
memo="Test 0",
amount="1",
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
assetIssuer="GARO4SCJCPO4QPW27EZQBDV5KY4GXXBH6FOLUQ73K73VC4NP5PGBANTU"
assetCode="BNR"
)
Another way to make payment
from bantupay_sdk import confirmPaymentDetail, makePayment
firstCall = confirmPaymentDetail(
username="proxie",
destination="long",
memo="Test 0",
amount="1",
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
)
data = firstCall.json() # to extract json data from the response.
Note!
Pass the response of the first call in to the makePayment function.
confirmPayment will return the respnse gotten from the server, this contains, firstName, lastName, destinationThumbnail, which can be used in stuff like your mobile apps and the likes, networkPhrase, transaction which will be returned in the makePayment and lastly message with will contain info like extra fees or charges that may acrue.
if data.status_code == 202: # all is right, you can move on to the next step
payment = makePayment(
username="proxie",
serverResponse=firstCall,
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
)
else:
# handle payment here.
pass
# Let's make a BNR payment
# for mainnet, BNR issuer is GARO4SCJCPO4QPW27EZQBDV5KY4GXXBH6FOLUQ73K73VC4NP5PGBANTU,
# for testnet BNR issuer is GBNRQ56XX4JA3HKXP7EACLLXYPHCYCWBWOQZYSPGUIJSR5JSAD22EZXG
# Please ensure that you use the right issuer
firstCall = confirmPaymentDetail(
username="proxie",
destination="long",
memo="Test 0",
amount="1",
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
assetIssuer="GARO4SCJCPO4QPW27EZQBDV5KY4GXXBH6FOLUQ73K73VC4NP5PGBANTU"
assetCode="BNR"
)
data = firstCall.json()
# If all is well, your status code will 200, then pass the response of the first call in to the makePayment function
if data.status_code == 202:
payment = makePayment(
username="proxie",
serverResponse=firstCall,
secretKey="SBVNK4S2NU2QSBDZBKQCGR7DX5FTQFDJVKGWVCZLIEOV4QMANLQYSLNI",
baseURL="https://api.bantupay.org" # or https://api-alpha.dev.bantupay.org for testnet
)
else:
# handle your errors here
print(data)
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
Built Distribution
File details
Details for the file bantupay-sdk-0.0.10.tar.gz
.
File metadata
- Download URL: bantupay-sdk-0.0.10.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcf2bad8dfe024abe072f9a86240cda8eea9f3c53d897a0e15fb772bd0a7fca8 |
|
MD5 | 2153265d62286117141c052682cf73af |
|
BLAKE2b-256 | 92e19eb904b70b618848e46311488ab59d5c9714282696151b92fd304da24060 |
File details
Details for the file bantupay_sdk-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: bantupay_sdk-0.0.10-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ede9b759f51a28c8ab3f1a7e17b70747451170dcc611df143682b4dbdbc01d |
|
MD5 | 720eb553e685ac9cb243acd08eaeede3 |
|
BLAKE2b-256 | 3810335cd67c5a9ea6707e0a4eb793ae66ed956aa38f67e6e7756610d6288dd2 |