Skip to main content

A package to manage multiple payment gateways

Project description

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.

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

persian_payment_gateway-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

persian_payment_gateway-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file persian_payment_gateway-1.0.1.tar.gz.

File metadata

File hashes

Hashes for persian_payment_gateway-1.0.1.tar.gz
Algorithm Hash digest
SHA256 50db5bf8e349af7df563ce585ceb1ebc91a396807e3539c9ba68a73c6630e143
MD5 0b9bcb7c7ad850f70c5b51e2be2fb42f
BLAKE2b-256 b101f7bf0bdd761f1a77fed18b3b7ccd8dbbf58e351ee5b2be7574c9c7012dcd

See more details on using hashes here.

File details

Details for the file persian_payment_gateway-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for persian_payment_gateway-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 126bc5bdc6c3b2d5b00417614f5dc2c0f645d3c4b3e2affccc7661d9cc5c7321
MD5 7abd0876d01968879708acc4aaf5db37
BLAKE2b-256 75b801d3679bb763790c453de52d94ffa01a1fe77dab62ba9085a5c307aa7169

See more details on using hashes here.

Supported by

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