Skip to main content

Official Mooj SDK. Issue capped virtual cards and let your agent complete real checkouts.

Project description

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

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

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

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

Checkout (Mooj drives the buy)

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)

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.

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mooj-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mooj-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file mooj-0.1.0.tar.gz.

File metadata

  • Download URL: mooj-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mooj-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f4d147c2c1845821561d7f54f94395729e3798c5addccf8976cb73dbbea885f
MD5 15c4e782740ce12ab8b3bca1b5714bcd
BLAKE2b-256 c49e7cbd798508ec1babb184378e25d23ebc2bbfffa651224e3778e874950c01

See more details on using hashes here.

File details

Details for the file mooj-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mooj-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mooj-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fadceda1c37dc525a631791d727c9be6311606e1a3a5530476136860f7b9ad5a
MD5 794758fd103b5a8635d5407f35736c2a
BLAKE2b-256 ff4149ba494edde23f04d92eedc4a4aa38370fc27a4c01809e4ad850b8319624

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page