Simple and flexible pluggable cryptocurrency payment app for django. Coins are spendable and reflect on HD wallet like Electrum
Documentation
The full documentation is at https://django-cryptocurrency-payment.readthedocs.io.
Quickstart
Install Django Cryptocurrency Payment:
pip install django-cryptocurrency-payment
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'cryptocurrency_payment.apps.CryptocurrencyPaymentConfig',
...
)
CRYPTOCURRENCY_PAYMENT = {
"BITCOIN": {
"CODE": "btc",
"BACKEND": "merchant_wallet.backends.btc.BitcoinBackend",
"FEE": 0.00,
"REFRESH_PRICE_AFTER_MINUTE": 15,
"REUSE_ADDRESS": False,
"ACTIVE": True,
"MASTER_PUBLIC_KEY": 'PUT_YOUR_WALLET_MASTER_PUBLIC_KEY',
"CANCEL_UNPAID_PAYMENT_HRS": 24,
"CREATE_NEW_UNDERPAID_PAYMENT": True,
"IGNORE_UNDERPAYMENT_AMOUNT": 10,
"IGNORE_CONFIRMED_BALANCE_WITHOUT_SAVED_HASH_MINS": 20,
"BALANCE_CONFIRMATION_NUM": 1,
"ALLOW_ANONYMOUS_PAYMENT": True,
"DERIVATION_PATH": "m/0", #please use deriavation path from your wallet
"ADDRESS_TYPE": "p2wpkh" #specify address type you want to generate p2pkh p2sh p2wpkh p2wsh p2wpkh_in_p2sh
},
"LITECOIN": {
"CODE": "LTC",
..
..
..
..
}
}
Add Django Cryptocurrency Payment’s URL patterns:
from cryptocurrency_payment import urls as cryptocurrency_payment_urls
urlpatterns = [
...
url(r'^', include(cryptocurrency_payment_urls)), #/payment/{pk}/
...
]
Create payment with method
from cryptocurrency_payment.models import create_new_payment
payment = create_new_payment(
crypto='BITCOIN', #Cryptocurrency from your settings
fiat_amount=10, #Amount of item in fiat
fiat_currency='USD', #Fiat currency used to convert to crypto amount
payment_title=None, #Title associated with payment
payment_description=None, #Description associated with payment
related_object=None, #Generic linked object for this payment -> crypto_payments = GenericRelation(CryptoCurrencyPayment)
user=None, #User of this payment for non-anonymous payment
parent_payment=None, #Associate with previous payment
address_index=None,# Use an address generated from a particular index for this payment e.g same address can always be used for a particular user
reuse_address=None), #Used previously paid address for this payment
Tasks
Run these tasks periodically based on your preferred time using your favorite django task manager
cryptocurrency_payment.tasks.update_payment_status
cryptocurrency_payment.tasks.cancel_unpaid_payment
cryptocurrency_payment.tasks.refresh_payment_prices
Features
Flexible payment creation that can be linked to other django object
Automatically update payment status from blockchain
Auto update payment prices if payment is not paid
Auto create child payment if payment is underpaid
Cancel unpaid payment after a period of time
Allow Anonymous payment
Pluggable backend to support more cryptocurrency
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Credits
Tools used in rendering this package:
History
0.1.0 (2020-03-21)
First release on PyPI.
Metadata
Release files for django-cryptocurrency-payment 0.1.2
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 | |
|---|---|---|---|---|
| django-cryptocurrency-payment-0.1.2.tar.gz | 16.4 kB | Without provenance | Details |
Release files / django-cryptocurrency-payment-0.1.2.tar.gz
| Download URL | django-cryptocurrency-payment-0.1.2.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19050e728a2d4803facd9be469399b47e2b627b1859db4819d729ae15187c75b
|
|
BLAKE2b-256 checksum How to use checksums |
67c2bc75b9eb9bf9da7e3b2364c0c178842992302a117c16df6d66dea1abb0fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.1 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.13 CPython/3.8.13
|
Security for django-cryptocurrency-payment 0.1.2
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.