Python Package

This package is ideal for Python developers looking to integrate Paylink's payment processing capabilities into their applications with minimal effort. It provides functionality to add and retrieve invoices.

Package Link:

https://pypi.org/project/paylink-package


Usage

Install the Package:

You can install the package using pip:

pip install paylink-package==1.0.6
  • Note: Use the latest version

Import the Package:

from paylink import Paylink, PaylinkProduct

Initialize Paylink instance

  • For Testing
    paylink = Paylink.test()
    
  • For Production
    paylink = Paylink.production(
      api_id='xxxxx',
      secret_key='xxxxx'
    )
    

Package Functionalities

1. Add Invoice:

invoice_details = paylink.add_invoice(
    amount=10,
    client_mobile='966123456789',
    client_name='John Doe',
    order_number='1234567890',
    products=[
        PaylinkProduct(title='Hand bag', price=4, qty=1),
        PaylinkProduct(title='Book', price=3, qty=2),
    ],
    callback_url='https://paylink.sa/test-python-sdk',
    currency='USD',
)

print(invoice_details)
print('Transaction No:', invoice_details.transaction_no)
print('Payment Url:', invoice_details.url)

2. Get Invoice:

invoice_details = paylink.get_invoice(transaction_no=17214351564123)

print('Payment Status:', invoice_details.order_status)
print('Payment Url:', invoice_details.url)

3. Cancel Invoice:

cancellation_success = paylink.cancel_invoice(transaction_no=17214351564123) # true-false

4. Payment Status:

status = paylink.order_status(transaction_no=17214351564123)
print('Payment Status:', status)