Skip to main content

Django Tegro Money

Build Status Build Status

Django API connector for Tegro Money's HTTP APIs.

Table of Contents

About

Put simply, django-tegro-money is the lightweight one-stop-shop module for the Tegro Money's HTTP APIs.

It was designed with the following vision in mind:

I wanted to build my own Django-dedicated connector to Tegro Money the system for accepting online payments with very little external resources. The goal of the connector is to provide entrepreneurs and developers with an easy-to-use high-performing module that has an active issue and discussion board leading to consistent improvements.

Development

Tegro Money is being actively developed, and new API changes should arrive on Tegro Money very quickly. Tegro Money uses requests for its methods, alongside other built-in modules. Anyone is welcome to branch/fork the repository and add their own upgrades. If you think you've made substantial improvements to the module, submit a pull request, so we'll gladly take a look.

Installation

django-tegro-money requires Django 3.2 or higher and Python 3.8 or higher.

The module can be installed manually or via PyPI with pip:

pip install django-tegro-money

Add django-tegro-money to the INSTALLED_APPS in your settings.py:

INSTALLED_APPS = [
    ...,
    'django_tegro_money',
    ...,
]

Add an entry to your urls.py:

urlpatterns += [
    path('', include('django_tegro_money.urls')),
]

Run migration:

python manage.py migrate

Usage

The first before using django-tegro-money you must register with Tegro Money. Do it ....

Then you must add a store. Do it ....

You can find more information here.

NOTICE! Specify /payment_status/ as Notification URL:

Notification URL
URL: https://<your_site>/payment_status/

Add secret parameters of your store (Shop ID, Secret KEY and API KEY) in your settings.py (it's best to store secret settings locally):

TEGRO_MONEY_SHOP_ID = <Shop ID>
TEGRO_MONEY_SECRET_KEY = <Secret KEY>
TEGRO_MONEY_API_KEY = <API KEY>

Create TegroMoney object:

tegro_money = TegroMoney(log_requests=True, timeout=10, max_retries=3, retry_delay=3)

Just use TegroMoney methods:

# Create order and get payment

# Get data (you can get data from your form)
data = {
  "amount": 1200,
  "currency": "RUB",
  "order_id": "test order",
  "payment_system": 5,
  "fields": {
    "email": "user@email.ru",
    "phone": "79111231212"
  },
  "receipt": {
    "items": [
      {
        "name": "test item 1",
        "count": 1,
        "price": 600
      },
      {
        "name": "test item 2",
        "count": 1,
        "price": 600
      }
    ]
  }
}

# Send request to Tegro Money
try:
    result = tegro_money.create_order(**data)
    
    # Save order id from tegro money for future use
    tegro_money_order_id = result['data']['id']
    
    # Redirect to payment page
    return redirect(result['data']['url'])
except:
    pass

Metadata

Release files for django-tegro-money 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tegro-money 0.1.0
File Size Uploaded
django-tegro-money-0.1.0.tar.gz 13.2 kB Details

Release files / django-tegro-money-0.1.0.tar.gz

Download URL django-tegro-money-0.1.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
06fe88a71b759ddd8463d53807ba588a3e0102e0181d605c4bd2f84031d94aa2
BLAKE2b-256 checksum
How to use checksums
e2ee983f7d845b27c6f68df2db48d883a0b5ddc71dd7d5d73dc53315e526bd54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page