Skip to main content

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)

Metadata

Release files for bantupay-sdk 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bantupay-sdk 0.0.10
File Size Uploaded Provenance
bantupay-sdk-0.0.10.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bantupay-sdk 0.0.10
File Interpreter ABI Platform
bantupay_sdk-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / bantupay-sdk-0.0.10.tar.gz

Download URL bantupay-sdk-0.0.10.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dcf2bad8dfe024abe072f9a86240cda8eea9f3c53d897a0e15fb772bd0a7fca8
BLAKE2b-256 checksum
How to use checksums
92e19eb904b70b618848e46311488ab59d5c9714282696151b92fd304da24060
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bantupay_sdk-0.0.10-py3-none-any.whl

Download URL bantupay_sdk-0.0.10-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ede9b759f51a28c8ab3f1a7e17b70747451170dcc611df143682b4dbdbc01d
BLAKE2b-256 checksum
How to use checksums
3810335cd67c5a9ea6707e0a4eb793ae66ed956aa38f67e6e7756610d6288dd2
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for bantupay-sdk 0.0.10

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page