Metadata-Version: 2.4
Name: kobil-payment
Version: 1.0.0
Summary: KOBIL Pay (mpay-merchant) client for Python with automatic OAuth token management.
License: MIT
Project-URL: Repository, https://github.com/uveysservetoglu/kobil-sdks
Keywords: kobil,payment,mpay,oauth2
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: kobil-core>=1.0

# kobil-payment

KOBIL Pay (mpay-merchant) client for Python, with automatic OAuth token management.

```bash
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.

```python
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
