Quickstart
Get started with nekuda SDKs for AI agents to handle payments securely in minutes.
Prerequisites:
• nekuda Account: Sign up for a nekuda account and
obtain your API Keys from the nekuda Dashboard.
This guide walks you through setting up both frontend payment collection and backend payment handling using the nekuda SDKs. The primary API endpoint is https://api.nekuda.ai
.
Overview
nekuda provides two complementary SDKs:
- Frontend SDK (
@nekuda/react-nekuda-js
) - Securely collect payment details in your UI. This is typically a JavaScript library. - Backend SDK (
nekuda
) - Handle payments and reveal card details on your server. This guide focuses on the Pythonnekuda
package.
Frontend: Collect Payment Details
Use the @nekuda/react-nekuda-js
to securely capture credit card information from
the user and obtain a payment token or reference.
Backend: Handle Payments
Use the Python nekuda
SDK on your server to:
- Create a mandate (user’s intent to purchase) using a
user_id
. - Request a card reveal token using the
mandate_id
obtained from mandate creation. - Reveal card details using the token to complete the payment process in a guest checkout page.
Crucial Workflow Notes for Backend SDK (nekuda
):
- A unique
user_id
(string) identifying your end-user must be provided when creating aUserContext
(client.user(user_id)
). - A
MandateData
object describing the purchase must be created and sent to the API viauser.create_mandate(mandate_data)
to obtain amandate_id
. - This
mandate_id
is then required to request areveal_token
viauser.request_card_reveal_token(mandate_id)
.
Frontend Setup: Collect Payment Details
First, install the wallet SDK for your frontend (details usually found in its specific documentation):
Set up payment collection in your React application (example):
Replace pk_live_your_public_key_here
with your actual Public Key from
the nekuda Dashboard. Never expose your Secret Key
(sk_live_...
) in frontend code. The user_id
used in the frontend SDK
provider should match the user_id
used in your backend nekuda
SDK calls
for the same user.
Backend Setup: Process Payments with Python nekuda
SDK
Install the Python nekuda
package on your server:
Set up your backend (e.g., FastAPI) to handle payments using data from your frontend and the nekuda
SDK.
Environment Variables (Backend)
Set these environment variables on your server where the Python nekuda
SDK runs:
Always keep your Secret Key (sk_live_...
) secure on your backend. Never
expose it in client-side code or public repositories. The API endpoint
https://api.nekuda.ai
is the standard for production.
Complete Backend Flow Example (Python nekuda
SDK)
Here’s a standalone Python example focusing on the nekuda
SDK’s role after user and payment intent (mandate) information is known.
Testing Your Integration
Use test API keys and card details from the nekuda Dashboard during development.
Next Steps
Frontend SDK Guide
Detailed documentation for the @nekuda/react-nekuda-js
for frontend payment
collection.
Backend SDK: Getting Started
Dive deeper into the Python nekuda
SDK for backend payment processing.
Backend SDK: Error Handling
Build resilient applications with proper error handling for the nekuda
SDK.
Backend SDK: API Reference
Complete nekuda
SDK (Python) methods and response model documentation.
In production, ensure you are using your live API keys (pk_live_...
and
sk_live_...
) obtained from app.nekuda.ai. Implement
robust error handling, logging, and monitoring for all backend processes.