Coder Social home page Coder Social logo

fourthousand / django-cryptocurrency-payment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ydaniels/django-cryptocurrency-payment

0.0 0.0 0.0 66 KB

Simple and flexible app for accepting cryptocurrency payment with no much hassle

License: MIT License

Python 84.84% Makefile 3.12% HTML 12.04%

django-cryptocurrency-payment's Introduction

Django Cryptocurrency Payment

https://travis-ci.org/ydaniels/django-cryptocurrency-payment.svg?branch=master

PyPI - Python Version

Django Version

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,
    }
 }

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:

django-cryptocurrency-payment's People

Contributors

ydaniels avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.