The nekuda Card Management system enables your users to securely save and manage multiple payment methods. The frontend SDK collects and tokenizes card information, while your backend uses the stored cards with your secret key to handle information through your AI agents or automated workflows.
Key Benefits:
• Secure Storage: Cards are tokenized and linked to user IDs you manage
• Multiple Cards: Users can save and manage multiple payment methods
• PCI Compliant: Card details are tokenized and never touch your servers
• Backend Processing: Use stored cards in your agentic workflows with secret key
Important: The frontend SDK only collects and stores payment information. Actual information handling happens on your backend using the nekuda backend SDK with your secret API key. Never expose your secret key in frontend code.
User IDs are the key to linking saved cards with your users. You must generate and manage these IDs in your system:
Copy
Ask AI
// Example: Generate user ID when user signs up or logs infunction App() { // You generate and manage user IDs - they can be: // - Your database user IDs // - Session IDs // - Any unique identifier for your users const userId = getCurrentUserId(); // e.g., "user_abc123", "12345", etc. return ( <NekudaWalletProvider publicKey="pk_test_..." // Your publishable key (safe for frontend) userId={userId} // Your user's unique ID > {/* Your app */} </NekudaWalletProvider> );}
Best Practices for User IDs:
Use stable, persistent IDs (not session tokens that change)
Store the mapping between your user records and nekuda user IDs
Use the same user ID across sessions for returning users
// Let users manage their saved payment methodsfunction PaymentSettings() { const userId = getCurrentUserId(); // Your user ID return ( <NekudaCardManagement apiService={apiService} userId={userId} onCardSave={(card) => { console.log('Card saved for user:', userId); // Card is now available for backend information handling }} /> );}
Copy
Ask AI
// Let users manage their saved payment methodsfunction PaymentSettings() { const userId = getCurrentUserId(); // Your user ID return ( <NekudaCardManagement apiService={apiService} userId={userId} onCardSave={(card) => { console.log('Card saved for user:', userId); // Card is now available for backend information handling }} /> );}
Copy
Ask AI
// Collect payment info for single use (not saved)function SinglePurchase() { const { elements } = useNekudaWallet(); const handleSubmit = async () => { try { const result = await elements.submit(); // Send result to your backend for immediate processing await processPaymentOnBackend(result); } catch (error) { console.error('Collection failed:', error); } }; return ( <> <NekudaPaymentForm /> <button onClick={handleSubmit}> Submit Information </button> </> );}
Important Security Notes:
• Card numbers are tokenized immediately upon entry
• Only the last 4 digits are stored for display purposes
• CVV is never stored and must be re-entered for each transaction
• All card data transmission occurs over secure, encrypted channels