Setting up the AIS SDK
This guide covers the configuration and setup required to use the AIS SDK in your application.Environment Configuration
The SDK uses environment variables for configuration. Create a.env file in your project root:
Backend Integration
Your backend needs to provide endpoints for account linking and data retrieval. The SDK communicates with your backend API to:- Initiate Account Linking: Create consent requests and generate authorization URLs
- Handle Callbacks: Process authorization responses from Token.io
- Retrieve Account Data: Fetch accounts, balances, and transactions
Required Backend Endpoints
POST /sdk/link-token/{clientId}- Generate link token for account linkingGET /accounts/{consentId}- Retrieve linked accountsGET /accounts/{accountId}/balance- Get account balanceGET /accounts/{accountId}/transactions- Get transaction history
Security Configuration
API Authentication
Ensure your backend implements proper authentication:- Use Bearer tokens for API requests
- Validate client IDs and merchant permissions
- Implement rate limiting and request validation
Consent Management
- Store consent IDs securely with encryption
- Implement consent expiration handling
- Provide mechanisms for users to revoke consent
Data Protection
- Use HTTPS for all communications
- Implement proper data sanitization
- Follow GDPR and PSD2 compliance requirements
Runtime Configuration
The SDK can be configured at runtime by passing options to the constructor:Testing Setup
For testing in sandbox environment:- Use test credentials provided by AcountPay
- Configure sandbox API endpoints
- Test with mock bank data
- Verify consent flow without real financial data
Production Deployment
Before going live:- Update environment variables to production values
- Test with real bank connections (if available)
- Implement proper error handling and logging
- Set up monitoring and alerts
- Ensure compliance with regulatory requirements
Troubleshooting
Common Setup Issues
- Invalid Client ID: Verify your client ID from the merchant dashboard
- API Connection Failed: Check API base URL and network connectivity
- Environment Mismatch: Ensure sandbox/production settings match your API endpoints
- CORS Issues: Configure your backend to allow requests from your domain

