https://github.com/skioo/django-datatrans-gateway
A django integration for the datatrans payment gateway.
https://github.com/skioo/django-datatrans-gateway
datatrans django payment
Last synced: 5 months ago
JSON representation
A django integration for the datatrans payment gateway.
- Host: GitHub
- URL: https://github.com/skioo/django-datatrans-gateway
- Owner: skioo
- License: mit
- Created: 2017-08-02T16:25:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-27T14:32:51.000Z (almost 4 years ago)
- Last Synced: 2025-09-04T02:52:29.151Z (9 months ago)
- Topics: datatrans, django, payment
- Language: Python
- Homepage:
- Size: 104 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
django-datatrans-gateway
========================
[](https://travis-ci.org/skioo/django-datatrans-gateway)
[](https://badge.fury.io/py/django-datatrans-gateway)
[](https://requires.io/github/skioo/django-datatrans-gateway/requirements/?branch=master)
[](https://coveralls.io/github/skioo/django-datatrans-gateway?branch=master)
[](https://opensource.org/licenses/MIT)
A django integration for the datatrans payment gateway.
Supports:
- Direct payment by the user.
- Registration of a credit card alias by the user, followed by one or more charges (without the user being present).
- Refund (total or partial) of a previous successful charge.
This implementation:
- Handles the exchanges with datatrans, including the signing of requests and the verification of the signature of notifications. All exchanges are logged as structured events, to make auditing easy.
- Introduces persistent models for AliasRegistration, Payment, and Refund. Both successes and failures are stored.
- Offers a rich admin interface, allowing ad-hoc payments using registered credit cards, as well as refunds.
- Sends signals whenever an AliasRegistration, Payment, or Refund is done. The signal is sent even if the operation failed,
the receiver should check the `success` flag received with the signal.
Requirements
------------
* Python: 3.6 and over
* Django: 2.0 and over
Usage
-----
Add datatrans to your `INSTALLED_APPS`:
INSTALLED_APPS = (
...
'datatrans.apps.DatatransConfig',
)
Include `datatrans-urls` to the urlpatterns in your urls.py, for instance:
urlpatterns = [
url(r'^datatrans/', include('datatrans.urls')),
]
Configure the callback url in the datatrans UPP Administration page.
In your settings.py, enter the configuration for your web and mpo merchants. For instance:
DATATRANS = {
'WEB_MERCHANT_ID': '1111111111',
'WEB_HMAC_KEY': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
'MPO_MERCHANT_ID': '2222222222',
'MPO_HMAC_KEY': 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
}
Troubleshooting
---------------
If you don't see a payment (or a payment error) in the database, and you are sure you've properly configured the callback in the upp,
then start by looking in the log for a `datatrans-notification`.
Development
-----------
To install all dependencies:
pip install -e .
To run tests:
pip install pytest-django
pytest
To lint, typecheck, test, and verify you didn't forget to create a migration:
pip install tox
tox
To install the version being developed into another django project:
pip install -e