epay-chargily-python
Chargily ePay Gateway (Python Package)
This Plugin is to integrate ePayment gateway with Chargily easily.
- Currently support payment by CIB / EDAHABIA cards and soon by Visa / Mastercard
- This repo is recently created for Python package, If you are a developer and want to collaborate to the development of this package, you are welcomed!
Requirements
- Python 2.7 or higher.
- API Key/Secret from ePay by Chargily dashboard for free.
- Requests.
Installation
1- Install the package:
pip install chargily-epay-gateway
or pipenv
pipenv install chargily-epay-gateway
2- Setup the Environment Variables:
- Mac/Linux:
export CHARGILY_API_KEY='YOUR_API_KEY'
export CHARGILY_SECRET_KEY='YOUR_SECRET_KEY'
Usage
1- Make Payment:
- Class based way:
import os
from chargily_epay_gateway.api import Invoice
CHARGILY_API_KEY = os.environ["CHARGILY_API_KEY"]
invoice_payment = Invoice(CHARGILY_API_KEY)
invoice = invoice_payment.make_payment(
client='Client name goes here',
client_email='Client email goes here',
invoice_number='Invoice number as integer',
amount='Amount as float',
discount='Discount as float',
back_url='https://your-website-url/',
webhook_url='https://your-website-url/<webhook_path>/',
mode="CIB or EDAHABIA",
comment='Comment goes here',
)
invoice_payment.get_invoice() # Return the invoice as requests Response instance
invoice_payment.get_invoice_content() # Return invoice data as python data structure
Invoice.load_invoice(invoice.content) # Also return invoice data as python data structure
- Function based way:
import os
from chargily_epay_gateway.api import make_payment
CHARGILY_API_KEY = os.environ["CHARGILY_API_KEY"]
invoice = make_payment( # Return the invoice as requests Response instance
api_key=CHARGILY_API_KEY,
client='Client name goes here',
client_email='Client email goes here',
invoice_number='Invoice number as integer',
amount='Amount as float',
discount='Discount as float',
back_url='https://your-website-url/',
webhook_url='https://your-website-url/<webhook_path>/',
mode="CIB or EDAHABIA",
comment='Comment goes here',
)
2- Validate Chargily Signature:
import os
from chargily_epay_gateway.utils import signature_is_valid
CHARGILY_SECRET_KEY = os.environ["CHARGILY_SECRET_KEY"]
# Return True if signature is valid, otherwise False
valid_signature = signature_is_valid(CHARGILY_SECRET_KEY, invoice)
Configurations
- Available Configurations
| key | description | redirect url | process url |
|---|---|---|---|
| CHARGILY_APP_KEY | must be string given by organization | required | required |
| CHARGILY_APP_SECRET | must be string given by organization | required | required |
| back_url | must be string and valid url | required | not required |
| webhook_url | must be string and valid url _ | required | required |
| mode | must be in CIB,EDAHABIA | required | not required |
| invoice_number | string or int | required | not required |
| client_name | string | required | not required |
| clientEmail | must be valid email This is where client receive payment receipt after confirmation | required | not required |
| amount | must be numeric and greather or equal than 75 | required | not required |
| discount | must be numeric and between 0 and 99 (discount in %) | required | not required |
| description | must be string_ | required | not required |
Notice
- If you faced Issues Click here to open one
Metadata
Release files for chargily-epay-gateway 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chargily_epay_gateway-0.2.tar.gz | 6.4 kB | Details |
Release files / chargily_epay_gateway-0.2.tar.gz
| Download URL | chargily_epay_gateway-0.2.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1070f5bbe9f975ef7bc0d88ae40ce98a9fc91e21d346c0a44f0aeeb1942fc37b
|
|
BLAKE2b-256 checksum How to use checksums |
46e0d515238f8e21f194959fbca536679c44d3e8065a82fe8114d22605e6fc88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.2
|