Django app for Talar
Project description
django-talar
Django app for Talar service.
Installation
-
pip install django-talar
. -
Add
django_talar
to your django settingsINSTALLED_APPS
. -
Modify code below and also insert it into django settings:
TALAR = { 'project_id': env.str('TALAR_PROJECT_ID', None), 'key_id': env.str('TALAR_KEY_ID', None), 'key_secret': env.str('TALAR_KEY_SECRET', None), }
-
Include this into your core urls:
path('talar/', include(('django_talar.urls', 'talar'))),
Basic usage
django-talar contains basic form django_talar.forms.PaymentForm
and template
django_talar/talar_make_payment.html
for making payments. It is suggested to
use it by adding your own view like so:
def make_payment(request):
data = {
'external_id': EXTERNAL_ID, # You order/payment unique key that will be used to identify payment
'amount': AMOUNT, # your data
'currency': CURRENCY, # your data
'continue_url': CONTINUE_URL, # Insert address for redirection after successfull payment
}
talar = Talar(
settings.TALAR['project_id'],
settings.TALAR['key_id'],
settings.TALAR['key_secret']
)
url = talar.url
data = talar.create_payment_data(data)
payment_form = PaymentForm(data={
'key_id': talar.access_key_id,
'encrypted': data
})
return render(request, 'django_talar/make_payment.html', {
'url': url,
'payment_form': payment_form
})
html code will handle redirection if everything is correct:
<div>
<p>{% trans 'After continuing you will be redirected to payment provider site.' %}</p>
<form action="{{ url }}" method="post" class="form-inline">
{{ payment_form.as_p }}
<button type=submit class="btn btn-primary">{% trans 'Pay' %}</button>
</form>
</div>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-talar-1.3.0.tar.gz
(6.0 kB
view details)
File details
Details for the file django-talar-1.3.0.tar.gz
.
File metadata
- Download URL: django-talar-1.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 958debd25eaf1c7a1926df85079136491cc9fde4c5b2cb614c3dcea442d4c86d |
|
MD5 | 5c0cb0d9731a11cf9ea78ede7b95415f |
|
BLAKE2b-256 | a05632a16e34da3db535edcfaa28c6777a5435c28d010f16252b0bbea61161bc |