coinpayments-py icon indicating copy to clipboard operation
coinpayments-py copied to clipboard

CoinPayments crypto payment gateway API Client for Python

CoinPayments API Client

Build Status PyPI version License PyPI - Python Version PRs Welcome

Use this library to easily interact with CoinPayments crypto/coin payment gateway API directly from your Python 3 application.

Documentation

Installation

Use pip to install coinpayments-py:

pip install coinpayments-py

Basic Usage

Initialize api object

>>> from coinpayments import CoinPaymentsAPI

>>> api = CoinPaymentsAPI(public_key='your_api_public_key',
                          private_key='your_api_private_key')

Call any CoinPayments API method as api object method with corresponding arguments

>>> api.rates()
{'error': 'ok', 'result': 'LTCT': {'balance': 839700000, 'balancef': '8.39700000', 'status': 'available', 'coin_status': 'online'}}}

>>> api.get_callback_address(currency='BTC', ipn_url='http://example.com')
{'error': 'ok', 'result': {'address': '36v6r1XuaWPtrTuhF8iq8AfBzPS8D4eios'}}

Also, you can check IPN HMAC signature using check_signature method

>>> from coinpayments import CoinPaymentsAPI
>>> api = CoinPaymentsAPI(public_key=None,
                          private_key='your_ipn_secret_key')
>>> api.check_signature('ipn_message', 'ipn signautre')
False

Contributing

Contributions are welcome. You can learn how from this free series How to Contribute to an Open Source Project on GitHub.