A Python package designed for seamless integration with the Paylink API, ideal for developers who want to incorporate Paylink's payment processing capabilities into their applications effortlessly. It offers straightforward functionality for adding and retrieving invoices.
Project description
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.6
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:
-
Environment Configuration:
- Supports both production and test environments.
- Easy setup with API credentials for authentication.
-
Authentication:
- Secure authentication to obtain an ID token required for API interactions.
-
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.
-
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.
-
Comprehensive Response Handling:
- PaylinkInvoiceResponse Class: Parse and manage responses from the Paylink API, including transaction details, order status, payment errors, and more.
-
Error Handling:
- Robust error handling with meaningful exception messages for authentication, invoice creation, and data retrieval processes.
-
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
andproduction
).
Changelog
-
1.0.6
- New Method Added:
cancel_invoice
to cancel an existing invoice using the Paylink API.
- New Method Added:
-
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.
- Developed a
- 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.
- Introduced the
- Order Status Retrieval: Added functionality to retrieve the status of an order using its transaction number, allowing for effective tracking and management of orders.
- PaylinkProduct Class:
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
Built Distribution
File details
Details for the file paylink_package-1.0.6.tar.gz
.
File metadata
- Download URL: paylink_package-1.0.6.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d635251014d0cb3d8d5d5969a37bfafa58ee111ac4027334ecfdd77f89a2cfc |
|
MD5 | cef81f6db41089877070c2e456363518 |
|
BLAKE2b-256 | fc0278422a10698f4960b8314ced80f66e6b9c44809dd32b35df3262f595067b |
File details
Details for the file paylink_package-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: paylink_package-1.0.6-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3e0065c83df4147f05f07b723421a429303465acc98da9d909edef9afd346fd |
|
MD5 | dde4681f10c5bd61bc54554251431b23 |
|
BLAKE2b-256 | 87f2f7ec26f798618f986d3ed973aa7e7617633daa7a50e35ec2a940acf20202 |