Skip to main content

Python SDK for ZinariPay OpenAPI

Project description

Zinaripay SDK

Zinaripay SDK is a Python client library designed to simplify integration with the ZinariPay OpenAPI. This SDK allows developers to interact seamlessly with various payment functionalities provided by ZinariPay, such as creating payment links, handling transactions, managing wallets, and more.

Table of Contents

Features

  • Create payment links with custom parameters.
  • Initiate cryptocurrency transactions.
  • Retrieve transaction details by ID.
  • List all transactions.
  • Manage wallet operations.
  • Withdraw funds from wallets.
  • Fetch real-time exchange rates between currencies.

Installation

To install the Zinaripay SDK, you need to have Python 3.6 or higher installed. You can install the SDK using pip:

pip install zinaripaysdk  

Alternatively, you can clone the repository and install it locally:

git clone https://github.com/Ramseyxlil/zinaripay-sdk.git  
cd zinaripaysdk  
pip install .  

Usage

Initialization

To start using the SDK, you need to initialize it with your API key, which you can obtain from your ZinariPay account.

from zinaripaysdk import ZinariPaySDK  
  
# Initialize with your API key  
api_key = "your_api_key"  
zinari = ZinariPaySDK(api_key)  

Creating a Payment Link

To create a payment link, you can use the get_payment_link method. This method requires the fiat amount and the notification email.

payment_link = zinari.get_payment_link(  
    fiat_amount=80000,  
    notification_email="example@example.com",  
    details={"userId": "2445323", "productId": "PR45346t"},  
    success_redirect_uri="http://localhost:3001",  
    failure_redirect_uri="http://localhost:3001"  
)  
print(payment_link)  

Creating a Transaction

To initiate a cryptocurrency transaction, use the create_transaction method. Provide the cryptocurrency type, fiat amount, and notification email.

transaction = zinari.create_transaction(  
    cryptocurrency="USDT",  
    fiat_amount=15000,  
    notification_email="user@example.com",  
    details={"userId": "lmnopq"}  
)  
print(transaction)  

Retrieving Transaction Status

You can retrieve the status of a transaction by its ID using the get_transaction_by_id method.

transaction_id = "YOUR_TRANSACTION_ID"  
transaction_status = zinari.get_transaction_by_id(transaction_id)  
print(transaction_status)  

Listing Transactions

To list transactions, use the list_transactions method. You can specify whether to list production or development transactions.

# List production transactions  
transactions = zinari.list_transactions(mode="prod")  
print(transactions)  
  
# List development transactions  
dev_transactions = zinari.list_transactions(mode="dev")  
print(dev_transactions)  

Managing Wallets

You can retrieve all wallets associated with your account using the get_wallets method.

wallets = zinari.get_wallets()  
print(wallets)  

To get details about a specific wallet, use the get_wallet_by_id method:

wallet_id = "YOUR_WALLET_ID"  
wallet_details = zinari.get_wallet_by_id(wallet_id)  
print(wallet_details)  

Withdrawing from Wallet

To withdraw funds from a wallet, use the withdraw_from_wallet method. Provide the wallet ID, amount to withdraw, and destination address.

withdrawal = zinari.withdraw_from_wallet(wallet_id="YOUR_WALLET_ID", amount=100, address="YOUR_CRYPTO_ADDRESS")  
print(withdrawal)  

Getting Exchange Rates

To fetch the exchange rate between two currencies, use the get_exchange_rate method.

exchange_rate = zinari.get_exchange_rate(from_currency="USD", to_currency="EUR")  
print(exchange_rate)  

Error Handling

The SDK methods return JSON responses that may contain error messages. Ensure to handle exceptions or check for errors in the response.

Example of error checking:

response = zinari.create_transaction(...)  
if 'error' in response:  
    print(f"Error: {response['error']}")  

Contributing

Contributions are welcome! If you would like to contribute, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

zinaripaysdk-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

zinaripaysdk-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file zinaripaysdk-0.1.0.tar.gz.

File metadata

  • Download URL: zinaripaysdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for zinaripaysdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1fa3664599697a5050c8bbc3721e7c0684756a7a409a3ed10d955f314897f493
MD5 940a9370b37329dcad9e3ef09ba3a957
BLAKE2b-256 36ab9ee727254ce270cc329d1029f4cca7d21fafdc115e5107e40d06b8ec87aa

See more details on using hashes here.

File details

Details for the file zinaripaysdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zinaripaysdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for zinaripaysdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da1b660f6956dedfa2ece6f95f6d743b183b2d7ad90a416a76f150c955ed9d66
MD5 f8d7ee1be4bd0289bd2d8272c013609c
BLAKE2b-256 882f1b1f399aaae97ef3f0ea6dd1f8761755ce362be660dd676296e0223b1048

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