Skip to main content

Paylink 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.

Installation

You can install the package using pip:

pip install paylink-package==1.0.7

Usage

from paylink import Paylink, PaylinkProduct
# For Development & Test
paylink = Paylink.test()

# For Production
paylink = Paylink.production(api_id='xxxxx', secret_key='xxxxx')
# 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)
# Get Invoice

invoice_details = paylink.get_invoice(transaction_no=17214351564123)

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

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

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

Package Features:

The Paylink Python package provides a comprehensive integration with the Paylink Payment Gateway, enabling developers to create, manage, and track payment invoices easily. Key features include:

  1. Environment Configuration:

    • Supports both production and test environments.
    • Easy setup with API credentials for authentication.
  2. Authentication:

    • Secure authentication to obtain an ID token required for API interactions.
  3. Invoice Management:

    • Create Invoice: Generate new invoices with detailed product information, client details, and callback URLs.
    • Retrieve Invoice: Fetch invoice details using the transaction number.
    • Order Status: Retrieve the status of an order by its transaction number.
  4. Product Management:

    • PaylinkProduct Class: Create product objects with attributes like title, price, quantity, description, VAT, and digital product options.
    • Convert product data to and from dictionary format for easy serialization and deserialization.
  5. Comprehensive Response Handling:

    • PaylinkInvoiceResponse Class: Parse and manage responses from the Paylink API, including transaction details, order status, payment errors, and more.
  6. Error Handling:

    • Robust error handling with meaningful exception messages for authentication, invoice creation, and data retrieval processes.
  7. Ease of Use:

    • Designed with Python developers in mind, offering clear methods for interacting with the Paylink API.
    • Helper methods for initializing the package in different environments (test and production).

Changelog

  • 1.0.6

    • New Method Added: cancel_invoice to cancel an existing invoice using the Paylink API.
  • 1.0.5

    • Updated README File: Added detailed information about package features to provide users with a comprehensive overview of capabilities and functionalities.
    • Enhanced Changelog: Included a changelog section in the README file to keep users informed about updates and changes in each version.
  • 1.0.4

    • PaylinkProduct Class:
      • Developed a PaylinkProduct class to create and manage product objects with attributes such as title, price, quantity, description, VAT, and options for digital products.
      • Implemented methods for converting product data to and from dictionary format, facilitating easy serialization and deserialization for various use cases.
    • PaylinkInvoiceResponse Class:
      • Introduced the PaylinkInvoiceResponse class to parse and handle responses from the Paylink API. This includes managing transaction details, order status, payment errors, and other relevant information.
    • Order Status Retrieval: Added functionality to retrieve the status of an order using its transaction number, allowing for effective tracking and management of orders.

Metadata

Release files for paylink-package 1.0.7

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

Source distribution (sdist)

Source distribution for paylink-package 1.0.7
File Size Uploaded Provenance
paylink_package-1.0.7.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for paylink-package 1.0.7
File Interpreter ABI Platform
paylink_package-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Security for paylink-package 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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