Skip to main content

Django integration with ATOL online

Project description

Application for integrating Django and,%203.6-blue.svg

Important limitations:

  • Python 3.5+
  • Support Django 1.11+
  • PostgreSQL ≥ 9.4 (JSONB field)
  • only 1 purchase is supported in receipt (1 product)
  • only v3 protocol version is supported

Quick start

  1. Add atol to your INSTALLED_APPS setting like this:

  2. Add atol settings like this:

    RECEIPTS_ATOL_INN = '112233445573'
    RECEIPTS_ATOL_PAYMENT_ADDRESS = 'www.<your_company>.ru'
    RECEIPTS_ATOL_COMPANY_EMAIL = '<your_company>'
    RECEIPTS_OFD_URL_TEMPLATE = u'{fn}&fp={fp}'
  3. Add celery-beat tasks to CELERYBEAT_SCHEDULE settings like this:

        'atol_retry_created_receipts': {
            'task': 'atol_retry_created_receipts',
            'schedule': crontab(minute=25)
        'atol_retry_initiated_receipts': {
            'task': 'atol_retry_initiated_receipts',
            'schedule': crontab(minute=35)
  4. Include the atol URLconf in your project like this:

    from atol.views import ReceiptView
    url(r'^r/(?P<short_uuid>[\w]+)/$', ReceiptView.as_view(), name='receipt')
  5. Run python migrate atol to create the receipt model.

  6. Add receipt field to your payment model:

    from atol.models import Receipt
    receipt = models.OneToOneField(Receipt, verbose_name=_('Чек'), blank=True, null=True, on_delete=models.SET_NULL)
  7. Add the mechanics of calling a receipt creation after a successful payment. For example, this can be done through a signal that will be called upon successful payment:

    # <your_app>/
    payment_accepted = Signal(providing_args=['payment'])
    # <your_app>/providers/
    def process_payment(payment)
        payment_accepted.send(sender='google-play', payment=payment)
    # <your_app>/
    def init_payment_receipt(sender, payment, **kwargs):
        receipt = Receipt.objects.create(
        payment.receipt = receipt['receipt'])
            lambda: atol_create_receipt.apply_async(args=(,), fallback_sync=True)

Run tests



1.3.1 (2018-12-19)

  • Sell method: do not insert empty email or phone

1.3.0 (2018-12-19)

  • Support Atol protocol v4 (FFD 1.05)

1.2.2 (2018-10-08)

  • Change maximum retry counts for task atol_receive_receipt_report. Now its awaiting report for 29 hours.
  • Changed atol_retry_created_receipts and atol_retry_initiated_receipts tasks retry period. Now it will retry receipts from day before yesterday

1.2.1 (2018-05-22)

  • AtolAPI.base_url specifying in settings

1.2.0 (2017-12-14)

  • Support retried not processed receipt

1.1.0 (2017-12-13)

  • Django 2.0 support

1.0.0 (2017-12-01)

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-atol, version 1.3.1
Filename, size File type Python version Upload date Hashes
Filename, size django_atol-1.3.1-py2.py3-none-any.whl (15.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size django-atol-1.3.1.tar.gz (18.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page