Skip to main content

A unified payment gateway SDK for Iranian gateways.

Project description

Payman — Unified Payment Gateway Integration for Python

Payman is a Python package that simplifies integration with multiple Iranian payment gateways using async and sync APIs with a clean and unified interface.

Key Features

  • Unified API for multiple gateways
  • Sync and Async support (auto-detected)
  • Modular and extensible architecture
  • Clean Pythonic codebase

Supported Payment Gateways (Currently)

Installation

pip install payman

Quick Start: ZarinPal Integration (Create, Redirect, Verify)

Here's a simple example using ZarinPal:

import asyncio
from payman.gateways.zarinpal import ZarinPal
from payman.gateways.zarinpal.models import PaymentRequest, VerifyRequest

merchant_id = "YOUR_MERCHANT_ID"
amount = 1000

pay = ZarinPal(merchant_id=merchant_id)

# 1. Create Payment
create_resp = pay.payment(
    PaymentRequest(
        amount=amount,
        callback_url="https://your-site.com/callback",
        description="Test Order"
    )
)
    
if create_resp.code == 100:
    authority = create_resp.authority
    print("Redirect user to:", pay.get_payment_redirect_url(authority))
else:
    print(f"Create failed: {create_resp.message} (code {create_resp.code})")

# 2. After user returns to callback_url, verify the payment:
verify_resp = pay.verify(
    VerifyRequest(authority=authority, amount=amount)
)

if verify_resp.code == 100:
    print("Payment successful:", verify_resp.ref_id)
elif verify_resp.code == 101:
    print("Already verified.")
else:
    print("Verification failed:", verify_resp)

Full Documentation

For detailed instructions on using ZarinPal and other gateways with Payman, including all parameters, response codes, and integration tips, please refer to the complete guide:

License

Licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.

Contributing

Contributions to Payman are welcome and highly appreciated. If you wish to contribute, please follow these guidelines:

  • Fork the repository and create a new branch for your feature or bugfix.
  • Ensure your code adheres to the project's coding standards and passes all tests.
  • Write clear, concise commit messages and provide documentation for new features.
  • Submit a pull request with a detailed description of your changes for review.

By contributing, you agree that your work will be licensed under the project's license.

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

payman-1.1.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

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

payman-1.1.0-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

Details for the file payman-1.1.0.tar.gz.

File metadata

  • Download URL: payman-1.1.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for payman-1.1.0.tar.gz
Algorithm Hash digest
SHA256 dded737bbbd27f8bfebd065839d9e2b35921b9f13ac9ebc43cc1aa4a959ab45c
MD5 3ef6a5e5b487f2c430a532cc87ec7759
BLAKE2b-256 708264f2ef60c135ac492d4a0c594b5e1834dd895f9b35ba833b912c0dd54dc5

See more details on using hashes here.

File details

Details for the file payman-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: payman-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for payman-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01bbae9b5b81bab92413ed94a44881a4dc347aceb4c1786976a49580c7ce7ba5
MD5 039f21897d208eaa48dd987a22cb188a
BLAKE2b-256 206d2f6a69e1b9ff900476834701ca86d6759c3b486c67ea90c923ab05e0bd26

See more details on using hashes here.

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