Quickstart
Welcome to the rapid-fire tour of the Nekuda Python SDK. In less than five minutes you will:
- install the package,
- authenticate with your API key, and
- run your first card-reveal workflow with type-safe responses.
TL;DR – copy the snippets below into a file called
hello.py, export your API key, run it, done.
💡 Don't forget! This Python SDK handles the backend payment processing. You'll also need to integrate our wallet collection SDK on your frontend to securely collect credit card details from users.
1. Installation
We recommend using UV (fast Rust-based pip replacement), but plain pip works just as well:
uv pip install nekuda
#-or-
pip install nekuda
The SDK ships as a single, pure-python wheel with minimal dependencies – install is ~1 s.
2. Authenticate
Grab your secret key from the Nekuda dashboard and export it as an environment variable:
export NEKUDA_API_KEY="sk_live_…" # required
# Optional – point the SDK to staging / localmock
export NEKUDA_BASE_URL="https://api.nekuda.ai"
That's all the configuration you need for the quickstart.
3. Hello World
from nekuda import NekudaClient
client = NekudaClient.from_env()
print("🚀 Authenticated! Your account ID is:", client.api_key[:8] + "…")
python hello.py
If everything is set-up correctly you should see:
🚀 Authenticated! Your account ID is: sk_live_12…
4. End-to-end flow with Type Safety 🎯
The snippet below walks through the full payment flow with type-safe responses:
from nekuda import MandateData, NekudaClient, NekudaError
client = NekudaClient.from_env()
user = client.user("test_user_123")
try:
# 1) Describe what the user is about to purchase
mandate = MandateData(
product="Premium Subscription",
price=49.99,
currency="USD",
merchant="Nekuda Corp"
)
# Create mandate - returns MandateCreateResponse
mandate_response = user.create_mandate(mandate)
print(f"✅ Created mandate: {mandate_response.mandate_id}")
# 2) Request a reveal token - returns CardRevealTokenResponse
reveal_response = user.request_card_reveal_token(mandate_response.mandate_id)
print(f"🔑 Token: {reveal_response.reveal_token}")
# IDE knows these fields exist! No more KeyErrors!
if reveal_response.expires_at:
print(f"⏰ Expires at: {reveal_response.expires_at}")
# 3) Exchange token for card details - returns CardDetailsResponse
card = user.reveal_card_details(reveal_response.reveal_token)
print(f"💳 **** **** **** {card.card_number[-4:]}")
print(f"📅 Expiry: {card.card_expiry_date}") # Always MM/YY format
print(f"👤 Name: {card.cardholder_name}")
except NekudaError as e:
print(f"❌ Error: {e}")
Run it and you'll see the card details with full type safety and IDE autocomplete support!
🔗 Complete Integration: Remember that in a real application, steps 1-2 happen on your backend (using this Python SDK), while the actual card collection happens on your frontend using our React wallet SDK.
5. Why Type Safety Matters 🛡️
With our new typed response models:
- No more
KeyError- IDE knows exactly what fields are available - Autocomplete everywhere - Your editor suggests available fields
- Validation built-in - Card numbers and expiry dates are validated
- Better error messages - Know exactly what went wrong
# Before (raw dicts) 😟
result = client.request_card_reveal_token(...)
token = result["reveal_token"] # Hope the key exists!
# After (typed models) 😊
result = client.request_card_reveal_token(...)
token = result.reveal_token # IDE autocomplete! Type checked!
What's next?
- 📚 Full Documentation – comprehensive guides, API reference, and integration examples
- Core Concepts – understand
NekudaClient,UserContext, and response models - Usage Guide – deep dive into the payment flow
- Configuration – production-ready settings
- Error Handling – build resilient applications
Happy hacking! 🎉
Release files for nekuda 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nekuda-0.2.10-py3-none-any.whl | Python 3 | none | any | Details |
Release files / nekuda-0.2.10-py3-none-any.whl
| Download URL | nekuda-0.2.10-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b6094712248f02b62b3725354e904f8afdbb7a10bd8001675b9f0b578510c82
|
|
BLAKE2b-256 checksum How to use checksums |
afd90e72a1693c5a467d55f72a3e8c899b7f3de39b2bd6b2667c02eb3e90c476
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.
Transparency log