Skip to content

Fadhila36/paynesia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paynesia

A framework-agnostic Python library for integrating multiple Indonesian payment gateways.

Supported Gateways & Documentation

Gateway English Tutorial Tutorial Bahasa Indonesia
Midtrans Read Baca
Xendit Read Baca
Doku Read Baca
Duitku Read Baca
AyoConnect Read Baca
Fonnte Read Baca

Security Notes

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.

Installation

pip install paynesia

Usage

import 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)

Contributing

We welcome contributions! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A framework-agnostic Python library for integrating multiple Indonesian payment gateways (Midtrans, Xendit, Doku, Duitku, AyoConnect).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages