kobil-payment
KOBIL Pay (mpay-merchant) client for Python, with automatic OAuth token management.
pip install kobil-payment
Credentials are shared across modules and read from KOBIL_* env vars if omitted.
merchant_id defaults to client_id. Amounts are in the smallest currency unit
(1300 = 13.00 TRY); timeouts in minutes.
from kobil.payment import PaymentClient, payment_group
payment = PaymentClient(
payment_base_url="https://pay.cloud.kobil.com/mpay-merchant/create/transaction",
merchant_name="ISPARK",
# credentials optional if KOBIL_* env vars are set:
client_id="...", client_secret="...", token_endpoint="https://idp/token",
)
res = payment.create_transaction(
user_id=user_id,
amount=1300,
payment_content=payment_group(("Service Amount", "10.0 TL"), ("Tax Amount", "3.0 TL")),
)
# res["transactionId"], res["status"]
payment.create_pre_auth_transaction(user_id, 1300)
payment.post_auth(transaction_id, 40)
payment.get_status(transaction_id)
payment.cancel(transaction_id, user_id, cancellation_message="Iptal")
payment.refund(transaction_id, user_id, 5555, currency="USD")
Each operation returns the decoded response dict. Failures raise
kobil.payment.KobilPaymentError (subclass of kobil.core.KobilError).
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kobil_payment-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kobil_payment-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36f9c2a8ddcd74fcfc747fdc03be784d73b4ea1b6217e8b600fb40420e82146a
|
|
| MD5 |
869bab57aaf361058802c7153ccd22aa
|
|
| BLAKE2b-256 |
218818b03435075d76cf2d8c87a10231bccce56398c69e404210d86e55483a2c
|