Skip to main content

A simple package to help you streamline your integration to Tingg APIs.

Project description

Tingg by Cellulant

Overview

This Tingg Checkout SDK helps you streamline your integration to the Tingg Checkout API to facilitate secure processing of payments. It includes functionality for payload validation and encryption of payment data.

Prerequisites

You need a Tingg account to use this package. If you don’t have one you can contact our account managers through tingg-checkout@cellulant.io and have your business registered & activated.

Visit our official documentation to find out more on how you can get started using Tingg.

Once you’re signed in, you will need to retrieve your API Keys, that is the `API Key`, `client ID` and `client secret`.

Installation

We’ll create a sample project with Flask <https://flask.palletsprojects.com/en/3.0.x/> using a .venv directory.

Give the project any name you like

mkdir <project-name>
cd <project-name>
python3 -m venv .venv
. .venv/bin/activate
pip install Tingg Flask requests python-dotenv pycryptodome

Usage

import os
from tingg import Express
from dotenv import load_dotenv
from flask import Flask, request, jsonify

load_dotenv()
app = Flask(__name__)

# Recommended
@app.route('/express', methods=['POST'])
def express_checkout():
    # Get these values from your .env file or CLI args
    env = os.getenv("ENV")
    api_key = os.getenv("API_KEY")
    client_id = os.getenv("CLIENT_ID")
    client_secret = os.getenv("CLIENT_SECRET")

    # Get the JSON payload from the request
    payload = request.json

    # A sample for value for request.json
    # {
    #     merchant_transaction_id: "mtr-dg9823euy3a",
    #     account_number: "acc-14n345j5599",
    #     msisdn: "254700000000",
    #     service_code: "JOHNDOEONLINE",
    #     country_code: "KEN",
    #     currency_code: "KES",
    #     customer_last_name: "John",
    #     customer_first_name: "Doe",
    #     customer_email: "tingg@cellulant.io",
    #     request_amount: "100",
    #     due_date: "2023-11-18 16:15:30",
    #     language_code: "en",
    #     request_description: "Dummy merchant transaction",
    #     fail_redirect_url: "https://webhook.site/88390df9-a496-432f-abe5-0cf3380fda54",
    #     success_redirect_url: "https://webhook.site/88390df9-a496-432f-abe5-0cf3380fda54",
    #     callback_url: "https://webhook.site/88390df9-a496-432f-abe5-0cf3380fda54",
    # }

    express = Express(env)
    result = express.create(api_key, client_id, client_secret, payload)

    # A sample response for the testing environment
    """
    {
        "long_url": "https://online.uat.tingg.africa/testing/express/checkout?access_key=...&encrypted_payload=...",
        "short_url": "https://online.uat.tingg.africa/testing/express/checkout/..."
    }
    """

    return jsonify(result)

Features

  • Payload Validation: Ensures that the provided payment payload adheres to specified criteria.

  • Encryption: Uses AES encryption to secure payment data during processing.

For more detailed usage instructions and examples, refer to the documentation.

Feedback

Feel free to reach us through our discussion forum.

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

Tingg-0.1.6.tar.gz (46.4 kB view hashes)

Uploaded Source

Built Distribution

Tingg-0.1.6-py3-none-any.whl (34.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page