Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paynesia-0.1.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paynesia-0.1.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file paynesia-0.1.2.tar.gz.

File metadata

  • Download URL: paynesia-0.1.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paynesia-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d51e7c0a4f343a6fed92160e2fc0f7ce98a47e079aae252efcec6a909881d253
MD5 9944fe2da823b7b04606cb1082718c1c
BLAKE2b-256 d31ad91e1bce370d831682b8d2331184537a0fc1d95368b4a18c648db040c102

See more details on using hashes here.

Provenance

The following attestation bundles were made for paynesia-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on Fadhila36/paynesia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paynesia-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: paynesia-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paynesia-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 305de49086ecf688cb58b911cfcb18e22a62f2643433c90a41b49bd071438828
MD5 a22baf52cbbd81c0adab822281a67cae
BLAKE2b-256 e5d73cdfbd7825be917dd330c9d3884ecb7bec6bb6b707815c8d70cda7200c5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for paynesia-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on Fadhila36/paynesia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page