Use this library to easily interact with CoinPayments crypto/coin payment gateway API directly from your Python 3 application.
- API Documentation on official website.
Use pip to install coinpayments-py:
pip install coinpayments-py
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
Contributions are welcome. You can learn how from this free series How to Contribute to an Open Source Project on GitHub.