Installation
Requirements
Python 3.10+
Django 4.2, 5.0, or 5.1
Django REST Framework 3.14+
Install from PyPI
pip install django-payment-midtrans
Optional Extras
Unfold Admin theme (beautiful admin dashboard):
pip install django-payment-midtrans[unfold]
Development tools (testing, linting):
pip install django-payment-midtrans[dev]
Documentation (Sphinx):
pip install django-payment-midtrans[docs]
All extras:
pip install django-payment-midtrans[unfold,dev,docs]
Install from Source
git clone https://github.com/rissets/django-payment-midtrans.git
cd django-payment-midtrans
pip install -e ".[unfold,dev]"
Dependencies
The package automatically installs:
Package |
Version |
Purpose |
|---|---|---|
Django |
>= 4.2 |
Web framework |
djangorestframework |
>= 3.14 |
REST API |
requests |
>= 2.28 |
HTTP client for Midtrans API |
celery |
>= 5.3 |
Async task processing |
django-celery-beat |
>= 2.5 |
Periodic task scheduling |
Midtrans Account
You need a Midtrans account to use this package:
Sandbox (free, for development): dashboard.sandbox.midtrans.com
Production (requires approval): dashboard.midtrans.com
After creating an account, get your credentials from: Settings → Access Keys in the Midtrans Dashboard.
You will need:
Server Key — Used for backend API calls
Client Key — Used for frontend card tokenization (credit card payments)
Merchant ID — Your merchant identifier