Metadata-Version: 2.4
Name: mooj
Version: 0.1.0
Summary: Official Mooj SDK. Issue capped virtual cards and let your agent complete real checkouts.
Project-URL: Homepage, https://storage.googleapis.com/mooj-docs/index.html
Author: Mooj
License: MIT
Keywords: 3ds,ai-agents,checkout,mooj,payments,virtual-cards
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# mooj

The official Mooj SDK for Python. Issue capped virtual cards and let your agent complete real checkouts. Card controls, 3DS, and fraud caps are handled for you. Zero dependencies.

## Install

```
pip install mooj
```

Requires Python 3.8+.

## Quickstart

```python
import os
from mooj import Mooj

mooj = Mooj(api_key=os.environ["MOOJ_API_KEY"])  # key looks like mk_live_...

# Issue a single-use card capped at $20
card = mooj.cards.create(amount=20, merchant="namecheap", single_use=True)
print(card["id"], card["last4"], card["spend_limit"])
```

Get your API key from the Mooj console (Developer -> API keys). Keep it server-side; never commit it.

## Tools

### Cards

```python
card = mooj.cards.create(amount=20, merchant="namecheap", single_use=True)
full = mooj.cards.reveal(card["id"])   # {"number","cvc","exp",...} — use at the moment of purchase
closed = mooj.cards.close(card["id"])  # release the unused reserve back to your wallet
```

### Spend status

```python
spend = mooj.spend.get(card["spend_request_id"])
# spend["status"]: "not_started" | "authorized" | "cleared" | "declined"
```

### Checkout (Mooj drives the buy)

```python
run = mooj.checkout.create(
    task="buy the domain mooj.click for 1 year",
    merchant="namecheap",
    amount=20,
    confirm_pay=False,  # dry run: stops at the final review. True = pay up to the cap.
)

status = mooj.checkout.get(run["checkout_id"])
# status["status"]: "queued" | "running" | "awaiting_approval" | "needs_login" | "submitted" | "blocked"
```

### Connections (login-gated merchants)

```python
conn = mooj.connections.create(merchant="namecheap", user_ref="user-123")
# open conn["connect_url"] so the user signs in, then:
mooj.connections.complete(conn["connection_id"])
# now pass connection_id to checkout.create to run signed-in
```

## Errors

Any non-2xx response raises `MoojError` with the HTTP status, the Mooj error code, and the request id.

```python
from mooj import Mooj, MoojError

try:
    mooj.cards.create(amount=999999, merchant="namecheap")
except MoojError as e:
    print(e.status, e.code, e.request_id)  # e.g. 402 insufficient_funds
```

## Configuration

```python
Mooj(
    api_key=os.environ["MOOJ_API_KEY"],
    base_url="https://mooj-api-277196974190.us-central1.run.app",  # optional override
    timeout=60.0,
)
```

## Docs

Full API reference: https://storage.googleapis.com/mooj-docs/index.html
