Acoriss Payment Gateway SDK (Python)
A lightweight Python SDK to create payment sessions with the Acoriss payment gateway.
Installation
Using pip:
pip install acoriss-payment-gateway
Quick Start
from acoriss_payment_gateway import PaymentGatewayClient
client = PaymentGatewayClient(
api_key="your-api-key",
api_secret="your-api-secret", # enables automatic HMAC-SHA256 signing
environment="sandbox", # or "live"
)
session = client.create_session(
amount=5000,
currency="USD",
customer={
"email": "john@example.com",
"name": "John Doe",
"phone": "+1234567890"
},
description="Payment for Order #1234",
callback_url="https://example.com/api/callback",
cancel_url="https://example.com/cancel",
success_url="https://example.com/success",
transaction_id="order_1234",
service_id="ecommerce_payment", # optional: categorize the payment
services=[
{
"name": "express_delivery",
"price": 1500,
"description": "Express delivery service",
"quantity": 1
}
]
)
print("Checkout URL:", session["checkout_url"])
Retrieve Payment Status
payment = client.get_payment("pay_1234567890")
print("Payment Status:", payment["status"]) # 'P' | 'S' | 'C'
print("Amount:", payment["amount"])
print("Expired:", payment["expired"])
print("Services:", payment["services"])
Payment status values:
'P'- Pending: Payment is awaiting completion'S'- Succeeded: Payment was successful'C'- Canceled: Payment was canceled or failed
Signature
By default the SDK computes X-SIGNATURE as HMAC-SHA256(body, apiSecret) if you provide api_secret.
If your gateway uses a different signing algorithm, you can:
- Provide a custom signer:
from acoriss_payment_gateway import PaymentGatewayClient
from acoriss_payment_gateway.signer import SignerInterface
class CustomSigner(SignerInterface):
def sign(self, data: str) -> str:
return my_custom_signature(data)
client = PaymentGatewayClient(
api_key="...",
signer=CustomSigner()
)
- Or override per call:
client.create_session(payload, signature_override="precomputed-signature")
Configuration
api_key: str (required)api_secret: str (optional; enables default HMAC-SHA256 signature)signer: SignerInterface (optional; custom signer)environment: "sandbox" | "live" (default: "sandbox")base_url: str (optional override of base URL)timeout: float (default: 15.0 seconds)
API
Methods
create_session(payload, signature_override=None)
Creates a new payment session.
Parameters:
amount: int - Amountcurrency: str - Currency code (e.g., "USD")customer: dict - Customer info with email, name, and optional phonedescription: str (optional) - Payment descriptioncallback_url: str (optional) - Webhook callback URLcancel_url: str (optional) - Cancel redirect URLsuccess_url: str (optional) - Success redirect URLtransaction_id: str (optional) - Merchant reference IDservice_id: str (optional) - Service categorization identifierservices: list (optional) - List of service itemssignature_override: str (optional) - Custom signature
Returns: dict - Session details with checkout URL
get_payment(payment_id, signature_override=None)
Retrieves payment status and details by payment ID.
Parameters:
payment_id: str - The payment ID (e.g., 'pay_1234567890')signature_override: str (optional) - Custom signature
Returns: dict - Payment details including status, services, and customer info
Error Handling
Errors raise APIError with status, data, and headers from the HTTP response when available.
from acoriss_payment_gateway.errors import APIError
try:
session = client.create_session(...)
except APIError as e:
print(f"Status: {e.status}")
print(f"Message: {e.message}")
print(f"Data: {e.data}")
Development
# Install dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Run tests with coverage
pytest --cov=acoriss_payment_gateway --cov-report=html
# Type checking
mypy acoriss_payment_gateway
# Linting
ruff check acoriss_payment_gateway
License
MIT
Metadata
Release files for acoriss-payment-gateway 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| acoriss_payment_gateway-0.1.3.tar.gz | 10.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acoriss_payment_gateway-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / acoriss_payment_gateway-0.1.3.tar.gz
| Download URL | acoriss_payment_gateway-0.1.3.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6e89ce133ef7ec810471054b0b1fb0a0c5585d90ffde982c41cd071472d6002
|
|
BLAKE2b-256 checksum How to use checksums |
be5b01f8b3ac4981f4dda7265029c2a0e8a53ed44d592e0747d49ed137b9267d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Release files / acoriss_payment_gateway-0.1.3-py3-none-any.whl
| Download URL | acoriss_payment_gateway-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3059f0e11c0ece0df33fb0309ca669594ba4c5f3cdaf7cd4529a26d59db4b57
|
|
BLAKE2b-256 checksum How to use checksums |
289628f48ef9b4f2e90b2c93141791261e0add60844df1c7dd8d72a47a0fd657
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Security for acoriss-payment-gateway 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.