Metadata-Version: 2.5
Name: paychef
Version: 1.0.0
Summary: PayChef SDK for Python - client library for the PayChef payment API
Project-URL: Homepage, https://www.paychef.com
Author: PayChef
License: The MIT License (MIT)
        
        Copyright (c) 2026 PayChef
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: gateway,paychef,paylink,payment,sdk
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Requires-Dist: requests>=2.25
Description-Content-Type: text/markdown

# PayChef SDK for Python

Official Python client library for the [PayChef](https://www.paychef.com) payment API. Python 3.9+, single dependency (`requests`).

## Installation

```bash
pip install paychef
```

## Quick Start

```python
from paychef import PayChef

paychef = PayChef(
    instance="your-instance-name",  # e.g. 'demo' for https://demo.paychef.com
    api_secret="your-api-secret",   # from your PayChef instance admin panel
)

# Create a payment gateway (checkout) and redirect your customer to `link`
gateway = paychef.gateway.create(
    amount=1000,  # in the smallest currency unit, e.g. 10.00 CHF
    currency="CHF",
    purpose="Order #1234",
    successRedirectUrl="https://shop.example.com/success",
    failedRedirectUrl="https://shop.example.com/failed",
)

print(gateway["link"])
```

## Verifying your credentials

```python
paychef.signature_check.retrieve()  # raises PayChefError if credentials are wrong
```

## Common operations

```python
# Check payment status after the customer returns
gw = paychef.gateway.retrieve(gateway["id"])
print(gw["status"])  # 'waiting' | 'confirmed' | ...

# Transactions
tx = paychef.transaction.retrieve(123)
txs = paychef.transaction.list(limit=50)
paychef.transaction.refund(123, amount=500)  # partial refund
paychef.transaction.capture(123)             # capture a reservation

# Subscriptions
sub = paychef.subscription.retrieve(1)
paychef.subscription.cancel(1)

# Invoices, paylinks, designs, payouts, QR codes, ...
invoice = paychef.invoice.create(
    title="Invoice 2026-001",
    amount=2500,
    currency="CHF",
    purpose="Consulting",
)
methods = paychef.payment_method.list()
payouts = paychef.payout.list()
```

## Error handling

Every failed API call raises a `PayChefError` with `status_code` and an optional machine-readable `reason`:

```python
from paychef import PayChef, PayChefError

try:
    paychef.gateway.create(amount=1000, currency="CHF")
except PayChefError as err:
    print(err.status_code, err, err.reason)
```

## Advanced configuration

```python
paychef = PayChef(
    instance="your-instance",
    api_secret="your-secret",
    version="1.8",   # pin a specific API version (default: '1.15')
    timeout=10,      # request timeout in seconds (default: 20)
)
```

## API reference

| Resource | Methods |
| --- | --- |
| `paychef.gateway` | `create`, `retrieve`, `delete` |
| `paychef.transaction` | `retrieve`, `list`, `charge`, `refund`, `capture`, `receipt`, `pre_authorize`, `cancel` |
| `paychef.subscription` | `create`, `retrieve`, `list`, `update`, `cancel` |
| `paychef.invoice` | `create`, `retrieve`, `delete` |
| `paychef.page` | `create`, `retrieve`, `list`, `delete` |
| `paychef.design` | `create`, `retrieve`, `list`, `update`, `delete` |
| `paychef.payout` | `retrieve`, `list`, `details` |
| `paychef.payment_method` | `retrieve`, `list` |
| `paychef.payment_provider` | `list` |
| `paychef.qr_code` | `create`, `retrieve`, `delete` |
| `paychef.bill` | `create`, `retrieve`, `list`, `update`, `delete` |
| `paychef.signature_check` | `retrieve` |
| `paychef.auth_token` | `create` |
| `paychef.ecr` | `pair`, `unpair`, `payment`, `cancel_payment`, `void_payment`, `get_payment`, `get_payment_methods` |

All methods return plain dicts (or lists of dicts for `list` methods). Amounts are always given in the smallest currency unit (e.g. Rappen/Cents). Request parameters are passed as keyword arguments and use the API's camelCase field names (e.g. `successRedirectUrl`).

## License

MIT — see [LICENSE](LICENSE).
