Skip to main content

Lipad Python SDK

Introduction

The Lipad Python SDK facilitates the integration of Lipad's Direct API and Checkout features into your Python applications. This comprehensive guide will assist you in the setup and utilization of the Lipad SDK.

Prerequisites

Before getting started, ensure you have the following:

  • Python: Ensure that you have Python installed on your system. You can download Python from the official Python website.
  • You have installed: requests, aiohttp, pycryptodome
  • Lipad API credentials, including the IV Key, Consumer Secret, Consumer Key.
  • Environment: Decide whether you want to work in the production or sandbox environment. Lipad provides different URLs for each environment, so choose accordingly.

Installation

  1. Download the Lipad SDK: Download the Lipad SDK and include it in your project.

    # Example using pip
    pip install lipad-sdk
    
  2. Import the Lipad class and necessary libraries:

    from lipad import Lipad
    import json
    import ayncio
    
  3. Create an asynchronous main function.

    async def main():
    
    // Replace these values with your actual credentials
    iv_key = "your_iv_key";
    consumer_secret = "your_consumer_secret";
    consumer_key = "your_consumer_key"
    environment = "sandbox", "production";
    charge_request_id = "your_charge_request_id"
    
  4. Running the script

    To execute the script and run the main function, add the following line at the end of your script:

    if __name__ == "__main__":
    asyncio.run(main())
    

Checkout Usage

  1. To initialize the Lipad class, provide the iv_key, consumer_key, consumer_secret, and environment parameters. The environment should be one of the following: 'production' or 'sandbox'.

    lipad = new Lipad(iv_key, consumer_key, consumer_secret, environment);
    
  2. Validate Payload

    ```bash
    payload = {
        "msisdn": "",
        "account_number": "",
        "country_code": "",
        "currency_code": "",
        "client_code": "",
        "due_date": "",
        "customer_email": "",
        "customer_first_name": "",
        "customer_last_name": "",
        "merchant_transaction_id": "",
        "preferred_payment_option_code": "",
        "callback_url": "",
        "request_amount": "",
        "request_description": "",
        "success_redirect_url": "",
        "fail_redirect_url": "",
        "invoice_number": "",
        "language_code": "en",
        "service_code": "",
    }
         lipad.validate_payload(payload)
    
  3. Convert payload to JSON String and encrypt Payload

    payload_json_string = json.dumps(payload)
    encrypted_payload = checkout.encrypt(payload_json_string)
    print("Encrypted Payload:", encrypted_payload)
    
  4. Get Checkout Status

    merchant_transaction_id = payload.get("merchant_transaction_id")
    print("Merchant Transaction ID:", merchant_transaction_id)
    
    checkout_data = await checkout.check_checkout_status(merchant_transaction_id)
    print("Checkout Data:", checkout_data)
    
  5. Build Checkout URL

    checkout_url = f"https://checkout2.dev.lipad.io/?access_key={access_key}&payload={encrypted_payload}"
    print("Checkout URL:", checkout_url)
    

Direct API Usage

  1. To initialize the Lipad class, provide the iv_key, consumer_key, consumer_secret, and environment parameters. The environment should be one of the following: 'production' or 'sandbox'.

    lipad = new Lipad(iv_key, consumer_key, consumer_secret, environment);
    
  2. Direct Charge

    await lipad.direct_charge(json.dumps(payload))
    
  3. Get Charge Request Status

    checkout_request_status = await checkout.get_charge_request_status(
    chargeRequestId
    )
    print("Checkout Request Status", checkout_request_status)
    

License

This SDK is open-source and available under the MIT License.

Metadata

Release files for lipad-sdk 1.0.5

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

Source distribution (sdist)

Source distribution for lipad-sdk 1.0.5
File Size Uploaded
lipad_sdk-1.0.5.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lipad-sdk 1.0.5
File Interpreter ABI Platform
lipad_sdk-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / lipad_sdk-1.0.5.tar.gz

Download URL lipad_sdk-1.0.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
084ab5f807834570c54385c85a21f8bd2f6d656715823cb125d4a124f56732b0
BLAKE2b-256 checksum
How to use checksums
db5dbf9d6688972b78e8534874386bb1ec76b8de0031aa17456a28c497bf8d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release files / lipad_sdk-1.0.5-py3-none-any.whl

Download URL lipad_sdk-1.0.5-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a714b8dcc78decd03990902b36af54de400816cedf74f25f72a3bec61fffc7ad
BLAKE2b-256 checksum
How to use checksums
1975011efa9c9b757e5ca72571411093496392b46a57f29a19249e190fef6f1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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