Skip to main content

A unified payment gateway SDK for Iranian gateways.

Project description

Payman

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.0.4.tar.gz (31.3 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.0.4-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for payman-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4ef5192a7d4b3cbe443fe992e1654f1f0ee04c7f709fe00371338abc8804c736
MD5 5cf006e4a6c123dc4836d395db15f40b
BLAKE2b-256 8f11ef4083cbae3c5c303ad2c5d1f9884fc8c64e1306a3bfdc939c2101417cab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: payman-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 45.5 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.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7722cc0e3e38b200fa1fb6d3d582ee74cb449ebe03966cebb40f3fdeb06f53b2
MD5 a506558d3397b7034378da27b4a3a2f5
BLAKE2b-256 f91ad3694071b0fab958c49df4bdff9cfb257b8235e66515bf77813f14fc67dd

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