A simple package to help you streamline your integration to Tingg APIs.
Project description
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
Built Distribution
File details
Details for the file Tingg-0.1.6.tar.gz
.
File metadata
- Download URL: Tingg-0.1.6.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc6e666810c9b70005b99a2751d0fcc092f8e06bcdd3c00262f9fbd6565296a |
|
MD5 | f753bb02c7c73c8dfdfd2f5e24a2cf27 |
|
BLAKE2b-256 | 36a7aea2381e713935e04f50876788ae87c7f5f19429fbbb501b8293bcf05106 |
File details
Details for the file Tingg-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: Tingg-0.1.6-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94b16203b3d8af0403d8a58e38b9e0587189743ba5040e74c833a7d7e1d1528c |
|
MD5 | 06f8c9f0cbf2ce16a1f38ad38804c782 |
|
BLAKE2b-256 | b3b7b86944137dbc62df6535618315aae0dbac2c693ec01dea2083c5c1637a49 |