Skip to main content

Persian Payment Gateway Package

Overview

The Persian Payment Gateway Package is a Python library designed to simplify the integration of multiple payment gateways into your application. It provides a unified interface to work with different payment providers like Zarinpal, PayPal, and others.

Features

  • Support for Multiple Payment Gateways: Easily integrate and switch between different payment providers.
  • Unified API: A consistent interface for creating and verifying payments across different gateways.
  • Customizable: Set minimum transaction amounts and choose whether to convert amounts to the required currency.

Supported Payment Gateways

Currently, the package supports the following payment gateways:

  1. Zarinpal: A popular payment gateway in Iran. It supports payments in both Tomans and Rials, depending on the user's preference.

We plan to add support for more gateways in future releases. Contributions for new gateway integrations are welcome!

Installation

You can install the package via pip:

pip install payment-gateway-package

Usage

Setting Up a Payment Gateway

To use a specific payment gateway, you need to create an instance of the corresponding class and provide necessary credentials.

Example with Zarinpal:

from payment_gateway.zarinpal import ZarinpalGateway

# Initialize the Zarinpal gateway with your merchant ID
zarinpal = ZarinpalGateway(merchant_id="YOUR_MERCHANT_ID")

# Create a payment link
link_info = zarinpal.create_payment_link(
    price=10000,
    description="Test payment",
    callback_url="http://yourcallback.com",
    convert_to_irr=True,
    min_amount=5000
)

print("Payment Link:", link_info["link"])

# Verify payment status
verification_result = zarinpal.verify_payment_status(
    price=10000,
    auth_token=link_info["auth_token"]
)

print("Verification Result:", verification_result)

Available Parameters

  • price: The amount to be paid (default is in the gateway's base currency).
  • description: A brief description of the payment.
  • callback_url: URL to redirect the user after the payment process.
  • convert_to_irr: Boolean value, if True converts the amount to Iranian Rials (Zarinpal-specific).
  • min_amount_irr: The minimum amount allowed for the transaction.
  • min_amount_irr: The maximum amount allowed for the transaction.

License

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

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Author

Abbas Rahimzadeh - arahimzadeh79@gmail.com

Acknowledgments

Special thanks to the open-source community for their valuable contributions and resources.

Release files for persian-payment-gateway 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for persian-payment-gateway 1.0.2
File Size Uploaded
persian_payment_gateway-1.0.2.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for persian-payment-gateway 1.0.2
File Interpreter ABI Platform
persian_payment_gateway-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / persian_payment_gateway-1.0.2.tar.gz

Download URL persian_payment_gateway-1.0.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5b422f5a99904b1115061745e4f9d9ac8309f09931717a4196c5689e71205996
BLAKE2b-256 checksum
How to use checksums
49693b18fe6ba6959e0f66b53392b36ede52c0d88c8f8cd4a47dbefee904ecc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / persian_payment_gateway-1.0.2-py3-none-any.whl

Download URL persian_payment_gateway-1.0.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f2181b5cb36cde9f89a0ae955630b1c5528b26256dc00dc1d0f0f4fe9c372cd
BLAKE2b-256 checksum
How to use checksums
0f8bb5947164f3e52a89a4a66c718e77995fa91c372d4e45eda3ecf8e7b8cfd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page