Crypto Pay API Python
A Python library for interacting with the Crypto Pay API, allowing you to accept payments in cryptocurrency and manage transactions easily.
Official documentation: https://help.crypt.bot/crypto-pay-api
Table of Contents
Installation
You can install the package using pip:
pip install crypto-pay-api-cryptobot
Usage
Getting Started
To start using the crypto_pay library, you first need to create an application and obtain an API token from the Crypto Pay bot. Once you have your token, you can create an instance of the CryptoPay class.
from crypto_pay import CryptoPay
# Your API token
TOKEN = 'YOUR_API_TOKEN'
# Create an instance of CryptoPay
crypto_pay = CryptoPay(TOKEN)
# Example: Get app information
try:
me = crypto_pay.get_me()
print(me)
except Exception as e:
print(f"Error: {e}")
API Methods
Here are some of the key methods you can use with the crypto_pay library:
1. Get App Information
me = crypto_pay.get_me()
print(me)
2. Create an Invoice
You can create a new invoice by specifying the asset and amount:
invoice = crypto_pay.create_invoice('BTC', '0.01', {
'description': 'Payment for services',
'expires_in': 3600 # Invoice expires in 1 hour
})
print(invoice)
3. Delete an Invoice
To delete an invoice, you need to provide the invoice ID:
result = crypto_pay.delete_invoice(invoice_id)
print(result) # Should return True on success
4. Create a Check
You can create a check that can be activated by a user:
check = crypto_pay.create_check('ETH', '0.05', pin_to_user_id=123456789)
print(check)
5. Transfer Coins
To transfer coins from your app's balance to a user, use the transfer method:
transfer_result = crypto_pay.transfer(user_id=123456789, asset='USDT', amount='10.00', spend_id='unique_spend_id')
print(transfer_result)
6. Get Invoices
Retrieve a list of invoices created by your app:
invoices = crypto_pay.get_invoices()
print(invoices)
7. Get Balance
Get the balance of your app:
balance = crypto_pay.get_balance()
print(balance)
8. Get Exchange Rates
Retrieve the exchange rates of supported currencies:
exchange_rates = crypto_pay.get_exchange_rates()
print(exchange_rates)
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! If you have suggestions for improvements or find bugs, please open an issue or submit a pull request.
Metadata
Release files for crypto-pay-api-cryptobot 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| crypto_pay_api_cryptobot-1.0.3.tar.gz | 5.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crypto_pay_api_cryptobot-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / crypto_pay_api_cryptobot-1.0.3.tar.gz
| Download URL | crypto_pay_api_cryptobot-1.0.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f62fe4924f747468376e6bb09e26e1611c2292f79d09717fff520b889fa51c93
|
|
BLAKE2b-256 checksum How to use checksums |
5f5eff12fd2a62af0e384c2e6f96de4323c1890615f2bbc58d466d59a9c48dd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Release files / crypto_pay_api_cryptobot-1.0.3-py3-none-any.whl
| Download URL | crypto_pay_api_cryptobot-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf29cab915696158d8cc2a3839c410b77eaf6dad468e4f4da3260fc7492f8c01
|
|
BLAKE2b-256 checksum How to use checksums |
e681b4135857c3db20ad06cf998c277518143484648573b62b3d525acf45da86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Security for crypto-pay-api-cryptobot 1.0.3
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.