Skip to main content

Saman bank payment gateway. SEP

Project description

درگاه پرداخت Seppy

Seppy یک پکیج پایتون برای ادغام با درگاه پرداخت سامان (SEP) است. این پکیج توابعی ساده برای تولید لینک پرداخت، تایید تراکنش و بازگرداندن تراکنش فراهم می‌کند.

ویژگی‌ها

  • تولید لینک پرداخت برای کاربران.
  • بررسی وضعیت تراکنش.
  • بازگردانی تراکنش در صورت لزوم.

نصب

برای نصب این پکیج از pip استفاده کنید:

pip install seppy

استفاده

ابتدا توابع مورد نیاز را وارد کنید:

from seppy import get_payment_link, verify_transaction, reverse_transaction

1. دریافت لینک پرداخت

از این تابع برای تولید لینک پرداخت و هدایت کاربران به درگاه بانک سامان استفاده کنید:

payment_data = get_payment_link(
    amount=100000,  # مبلغ به ریال
    redirect_url="https://yourwebsite.com/payment/callback",
    phone_number="09123456789",
    res_number="123456"
)

if payment_data["status"] == 1:
    print("آدرس پرداخت:", payment_data["url"])
else:
    print("خطا:", payment_data["errorDesc"])

2. تایید تراکنش

پس از انجام پرداخت، می‌توانید وضعیت تراکنش را با شماره مرجع بررسی کنید:

success, message = verify_transaction("REF123456")
if success:
    print("تراکنش با موفقیت تایید شد")
else:
    print("خطای تایید:", message)

3. بازگردانی تراکنش

در صورت نیاز، می‌توانید تراکنش را با شماره مرجع بازگردانی کنید:

success, message = reverse_transaction("REF123456")
if success:
    print("تراکنش با موفقیت بازگردانی شد")
else:
    print("خطای بازگردانی:", message)

مدیریت خطاها

هر تابع پیام‌های خطای دقیقی را برای کمک به اشکال‌زدایی ارائه می‌دهد. حتماً خطاها را به درستی مدیریت کنید.

مجوز

این پکیج تحت مجوز MIT منتشر شده است.

مشارکت

پیشنهادات و درخواست‌های اصلاحی استقبال می‌شود. لطفاً قبل از ایجاد تغییرات عمده، یک Issue باز کنید.

تماس

برای پشتیبانی با ایمیل freecyberhawk@gmail.com تماس بگیرید.


Seppy Payment Gateway

Seppy is a Python package for integrating with Saman Bank (SEP) Payment Gateway. It provides easy-to-use functions for generating payment links, verifying transactions, and reversing transactions.

Features

  • Generate a payment link for users to complete their payment.
  • Verify a transaction status.
  • Reverse a transaction when necessary.

Installation

Install the package using pip:

pip install seppy

Usage

First, import the required functions:

from seppy import get_payment_link, verify_transaction, reverse_transaction

1. Get Payment Link

Use this function to generate a payment link that redirects users to the Saman Bank payment gateway.

payment_data = get_payment_link(
    amount=100000,  # Amount in Rials
    redirect_url="https://yourwebsite.com/payment/callback",
    phone_number="09123456789",
    res_number="123456"
)

if payment_data["status"] == 1:
    print("Payment URL:", payment_data["url"])
else:
    print("Error:", payment_data["errorDesc"])

2. Verify a Transaction

After the payment is completed, you can verify the transaction using the reference number.

success, message = verify_transaction("REF123456")
if success:
    print("Transaction Verified Successfully")
else:
    print("Verification Failed:", message)

3. Reverse a Transaction

If necessary, you can reverse a transaction using its reference number.

success, message = reverse_transaction("REF123456")
if success:
    print("Transaction Reversed Successfully")
else:
    print("Reversal Failed:", message)

Error Handling

Each function returns meaningful error messages to help with debugging. Make sure to handle exceptions properly.

License

This package is released under the MIT License.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss your ideas.

Contact

For support, contact freecyberhawk@gmail.com.

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

seppay-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

seppay-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file seppay-0.1.0.tar.gz.

File metadata

  • Download URL: seppay-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for seppay-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a1884c6bc3b0e1b9f0d66d25d7d3913a2e5f8761fdc3ad91fba0bf4216d6f11
MD5 9c54feec9f6cb7202236c914a5e3b399
BLAKE2b-256 474c542862b48bd8087a88173dbdcbab6bc28a45dbbb2ce362d756b24d82a75e

See more details on using hashes here.

File details

Details for the file seppay-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: seppay-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for seppay-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2e42790d70e0b855247a97ab4381b7fe48006ce3d6f13dda1309aa158aa0fcd
MD5 3319f2451c99f2ab9192f19629e9de9e
BLAKE2b-256 b1cb562d1de52f68bc21c5e580de649192f9300b8607835269ecf678c7cda913

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