Automated billing and payments for Django with a REST API
Switch branches/tags
470-show-transactions-in-document-endpoint 476-sync-transaction-invoice-with-proforma 477-missing-document-to-pay 486-disable-payment-method 505-add-total-in-transaction-currency 507-helper-fields-to-payment-methods add-cancel-date-to-subscription-serializer add-complete-payment-view-to-context add-linting-to-build add-meta-info-transaction add-meta-transaction-to-api add-missing-admin-fields add-transaction-currency add-transition-data add_total_field admin-autocomplete allow-fail-transition-from-initial another-round-of-api-improvements autocreate-transactions-on-pm-verified automatic-transaction-creation-fixes automatic-transactions-for-issued-documents billing-cycles-refactoring braintree-tests braintree build-fixes bump-silver-version-1 cache-billing-documents-name caching celery-tasks-for-commands changes-after-integration codes-for-transaction-state-488 compute-totals-in-documents currencies-fixes currency-conversion-for-entries custom-xhtml2pdf desero-patch-1 dev-to-setup django-111 docker docs-edit document-generation-fixes document-pay-fix documentation documents-endpoint dont-delete-old-pdfs email-changes enhance-transaction-admin extra-field-transactions fix-cancel-at-end-of-billing-cycle fix-date-utils fix-docs-link fix-documents-transition-double-triggering fix-documents-wrong-currency fix-drone fix-execute-transaction-task fix-execute-transactions-task fix-execute-transactions-tests fix-link-header fix-mf-log-updateable-buckets-end-date fix-mf-logs-for-canceled-subs fix-migration-0043 fix-payment-method-detail-structure-#353 fix-pdf-generation fix-pdf-mark-as-clean fix-pdf-url-for-documents fix-requirements-inline-comments fix-should-be-billed-for-canceled-subs-615 fix-test-on-mysql fix-transactions-draft-documents-401 handle-related-documents-pay-exception hide-payu-url hugo implementation-example improve-admin improve-tests-ran-on-other-applications improve_update_transaction_status increase-phone-limit initialize-transaction integration-fixes log-separate-plan-and-mfs-amounts maintenance manage_transactions_command mask-silver-url master migration-phone modeladmin-static-methods monthly-bugs more-currencies more-fail-codes move-currencies multiple-char-filters multiple_storages one-email-form-customer output-actual-error#393 payment-methods payment-processor-example payment-processor-update-status-method payment-processors-reference payments payu-integration pdf-dirty-integer pdf-generation-task pdf-rendering-rework process-transaction process-transactions processors reduce-query-numbers refactor-payment-processors-rendering-methods refactor-payment-processors refactored-payment-processors remove-api-view remove-django-1.8-support remove-mailing-410 remove-namespace-from-celery remove-payment-processor remove-paymentr-processors remove-state-from-read-only-transaction remove-transaction-currency-default remove-transaction-email-templates remove-vendors-celery-app remove-versioneer remove-versioner requirements-update-1 retry-transactions revert-provider-email rework-templates round-transaction-sums run-python3-on-drone-too same-table-documents secrets seed-command small-changes-for-new-version small-fixes-after-integration small-fixes-from-integration somebody-review-this split-customer-name-field split-models split-payments split_classes stats subscription-meta-default-value swagger templates-improvements test-customer-phone-field test-transactions total-fixes transaction-form-template transaction-payment-processor-filter-fix transaction-state transactions-field travis-badge-fix travis try-to-optimize-documents-endpoint update-changelong-1 update-license update-readme-links update-readme use-absolute-url-method-in-tests vasiioandre-silver-meta-descriptions
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Updated silver guide for hugo Oct 19, 2018
fixtures Added payment processor to method. Fixes #382 (#392) Dec 6, 2016
hooks Python2 and Python3 compatibility. (#619) Oct 16, 2018
requirements Bumped cryptography version. Nov 2, 2018
silver Removed test_get_jwt_token since it doesn't add value. Nov 2, 2018
.drone.sec Added pep8 linting requirements to CI build. (#523) Feb 9, 2017
.drone.yml Run build against Python3.5 as well. Nov 2, 2018
.gitattributes Added versioneer for version management Jan 26, 2017
.gitignore Update docs theme Mar 16, 2018
.travis.yml Run build against Python3.5 as well. Nov 2, 2018
AUTHORS Update authors list Dec 21, 2015 Update changelog. Nov 2, 2018 Update contribution guide Dec 23, 2015
DESCRIPTION Update description Dec 23, 2015
Dockerfile Added openssl-dev in container Sep 11, 2017
LICENSE Add Apache license Dec 21, 2015 Removed versioneer. Sep 28, 2017
Makefile Allow inline comments in requirements. Nov 21, 2017 Added FOSSA badge. Nov 2, 2018
docker-compose.env Add docker support (#359) Nov 16, 2016
docker-compose.yml Add docker support (#359) Nov 16, 2016
docker-entrypoint Add docker support (#359) Nov 16, 2016 Change settings_local approach (#381) Nov 24, 2016
requirements.txt Get general requirements from requirements/common Dec 23, 2015 Fix PDF on Django 1.11 (#577) Nov 16, 2017 Update local sqlite database so it is gitignored Jan 10, 2017 Use for tests. Jul 24, 2017
setup.cfg Removed versioneer. Sep 28, 2017 Prepare v0.6.2 release. Aug 10, 2018


Build Status Build Status FOSSA Status

A Django automated billing system with a REST API.

Silver was developed by the awesome engineering team at Presslabs, a Managed WordPress Hosting provider.

For more open-source projects, check Presslabs Code.


To get the latest stable release from PyPi

sudo apt-get build-dep python-imaging
pip install django-silver

To get the latest commit from GitHub

pip install -e git+git://

Add silver to your INSTALLED_APPS

    # ...,

Add the silver URLs to your

urlpatterns = patterns('',
    url(r'^silver/', include('silver.urls')),

Don't forget to migrate your database

./ migrate silver


For the complete API reference, check the project's documentation.

Automated tasks

To run Silver automatically you have two choices, although we really recommend the first one. You can either:

  • Use Celery (4.x) and setup a celery-beat for the following tasks (recommended):

    • silver.tasks.generate_documents
    • silver.tasks.generate_pdfs
    • silver.tasks.execute_transactions (if making use of silver transactions)
    • silver.tasks.fetch_transactions_status (if making use of silver transactions, for which the payment processor doesn't offer callbacks)

    Requirements: Celery-once is used to ensure that tasks are not queued more than once, so you can call them as often as you'd like. Redis is required by celery-once, so if you prefer not to use redis, you will have to write your own tasks.

  • Setup CRONs which call the following Django commands (e.g. ./ generate_documents):

    • generate_documents
    • generate_pdfs
    • execute_transactions (if making use of silver transactions)
    • fetch_transactions_status (if making use of silver transactions, for which the payment processor doesn't offer callbacks)

    You'll have to make sure that each of these commands is not run more than once at a time.

Billing documents templates

For creating the PDF templates, Silver uses the built-in templating engine of Django. The template variables that are available in the context of the template are:

  • name
  • unit
  • subscription
  • plan
  • provider
  • customer
  • product_code
  • start_date
  • end_date
  • prorated
  • proration_percentage
  • metered_feature
  • context

For specifying the storage used add the SILVER_DOCUMENT_STORAGE setting to your settings file. Example for storing the PDFs on S3:

    'storages.backends.s3boto.S3BotoStorage', [], {
        'bucket': 'THE-AWS-BUCKET',
        'access_key': 'YOUR-AWS-ACCESS-KEY',
        'secret_key': 'YOUR-AWS-SECRET-KEY',
        'acl': 'private',
        'calling_format': 'boto.s3.connection.OrdinaryCallingFormat'

Payment Processors settings

Here's an example for how the PAYMENT_PROCESSORS Django setting should look like, for the Braintree payment processor:

# put this in your
braintree_setup_data = {
    'environment': braintree.Environment.Production,
    'merchant_id': BRAINTREE_MERCHANT_ID,
    'public_key': BRAINTREE_PUBLIC_KEY,
    'private_key': BRAINTREE_PRIVATE_KEY

    'braintree_triggered': {
        'class': 'silver_braintree.payment_processors.BraintreeTriggered',
        'setup_data': braintree_setup_data,
    'braintree_recurring': {
        'class': 'silver_braintree.payment_processors.BraintreeTriggeredRecurring',
        'setup_data': braintree_setup_data,

Current available payment processors for Silver are:

Other available settings

  • SILVER_DEFAULT_DUE_DAYS - the default number of days until an invoice is due for payment.
  • SILVER_DOCUMENT_PREFIX - it gets prepended to the path of the saved files. The default path of the documents is {prefix}{company}/{doc_type}/{date}/{filename}
  • SILVER_PAYMENT_TOKEN_EXPIRATION - decides for how long the pay_url of a transaction is available, before it needs to be reobtained
  • SILVER_AUTOMATICALLY_CREATE_TRANSACTIONS - automatically create transactions when a billing document is issued, for recurring payment methods

Other features

To add REST hooks to Silver you can install and configure the following packages:

Getting Started

  1. Create your profile as a service provider.
  2. Add your pricing plans to the mix.
  3. Import/add your customer list.
  4. Create subscriptions for your customers.
  5. Create your custom templates using HTML/CSS or use the ones already provided.
  6. Setup cron job for generating the invoices automatically.
  7. Enjoy. Silver will automatically generate the invoices or proforma invoices based on your providers' configuration.


Development of silver happens at

Issues are tracked at

The Python package can be found at

You are highly encouraged to contribute with code, tests, documentation or just sharing experience.

Please see for a short guide on how to get started with Silver contributions.