A framework-agnostic Python library for integrating multiple Indonesian payment gateways.
| Gateway | English Tutorial | Tutorial Bahasa Indonesia |
|---|---|---|
| Midtrans | Read | Baca |
| Xendit | Read | Baca |
| Doku | Read | Baca |
| Duitku | Read | Baca |
| AyoConnect | Read | Baca |
| Fonnte | Read | Baca |
Important
Signature Verification: Always verify webhook signatures to prevent fraud. This library provides built-in signature verification in handle_webhook for all supported gateways.
Doku Gateway: You MUST pass the request_path argument (e.g., /api/callbacks/doku) to handle_webhook for strict signature verification.
Ayoconnect Gateway: Signature verification requires either client_secret (for HMAC) or public_key (for RSA). If using RSA, ensure the cryptography library is installed.
Xendit Gateway: Please configure webhook_secret to enable HMAC signature verification. Legacy callback_token usage is deprecated.
Environment Variables: Never hardcode your keys. Use environment variables and pass them to the configuration.
pip install paynesiaimport os
from paynesia.manager import PaymentManager
# Optional: if using python-dotenv to load .env file
# from dotenv import load_dotenv
# load_dotenv()
config = {
'default': 'midtrans',
'gateways': {
'midtrans': {
'server_key': os.getenv('MIDTRANS_SERVER_KEY'),
'is_production': os.getenv('MIDTRANS_IS_PRODUCTION', 'False') == 'True'
}
}
}
manager = PaymentManager(config)
payment = manager.driver('midtrans').create_payment({
'order_id': 'ORDER-123',
'amount': 10000,
'customer': {'email': 'user@example.com'}
})
print(payment)We welcome contributions! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.