Troubleshooting
Common issues and solutions when integrating with the Finternet API.
Authentication Issues
Invalid API Key
Error:
{
"error": {
"code": "forbidden",
"message": "Invalid API key",
"type": "authentication_error"
}
}
Solutions:
- Verify your API key is correct (no extra spaces or characters)
- Check that you're using the correct environment key (
sk_test_vssk_live_) - Ensure the API key is included in the
X-API-Keyheader - Verify the API key hasn't been revoked or rotated
Missing API Key
Error:
{
"error": {
"code": "authentication_required",
"message": "API key is required",
"type": "authentication_error"
}
}
Solutions:
- Add the
X-API-Keyheader to your request - Check environment variables are loaded correctly
- Verify API key is not empty or undefined
Payment Intent Issues
Invalid State Transition
Error:
{
"error": {
"code": "invalid_state_transition",
"message": "Cannot confirm payment intent in status: SUCCEEDED",
"type": "invalid_request_error"
}
}
Solutions:
- Check the current payment intent status before attempting operations
- Ensure you're following the correct state flow:
INITIATED→PROCESSING→SUCCEEDED→SETTLED
- Don't try to confirm an already confirmed payment
Signature Verification Failed
Error:
{
"error": {
"code": "signature_verification_failed",
"message": "Signature verification failed",
"type": "invalid_request_error"
}
}
Solutions:
- Ensure you're using the correct
typedDatafrom the payment intent - Verify the signature is for the correct
payerAddress - Check that you're using EIP-712 signing (not personal_sign)
- Ensure the domain, types, and message match exactly
- Verify the chain ID matches the network you're using
Escrow Order Issues
Invalid Order Status for Delivery Proof
Error:
{
"error": {
"code": "invalid_status",
"message": "Cannot submit delivery proof: order status is 2, must be Created (0)",
"type": "invalid_request_error"
}
}
Solutions:
- Check the escrow order status before submitting delivery proof
- Ensure the order is in
Created (0)status - Verify the payment intent has been confirmed and funds are locked
- Check the order lifecycle:
Created (0) → Delivered (2) → AwaitingSettlement (3) → Completed (4)
Delivery Proof Already Submitted
Symptom: Trying to submit delivery proof but order already has actualDeliveryHash
Solutions:
- Check if delivery proof was already submitted
- Retrieve the escrow order to see existing delivery proof
- If proof needs to be updated, contact support
Milestone Issues
Previous Milestone Not Completed
Error:
{
"error": {
"code": "invalid_request",
"message": "Previous milestone (index 0) must be completed first",
"type": "invalid_request_error"
}
}
Solutions:
- Complete milestones in sequential order (0, 1, 2, ...)
- Check which milestones are already completed
- Complete the previous milestone before moving to the next
Milestone Amount Exceeds Order Total
Error:
{
"error": {
"code": "invalid_request",
"message": "Total milestone amounts exceed escrow order amount",
"type": "invalid_request_error"
}
}
Solutions:
- Verify milestone amounts don't exceed the escrow order amount
- Check that the sum of all milestone amounts equals the order amount
- Adjust milestone amounts if needed
Network Issues
Connection Timeout
Symptom: Requests timeout or fail to connect
Solutions:
- Check your internet connection
- Verify the API base URL is correct:
https://api.fmm.finternetlab.io/v1 - Check for firewall or proxy issues
- Try increasing request timeout
- Implement retry logic with exponential backoff
SSL Certificate Errors
Symptom: SSL/TLS certificate verification errors
Solutions:
- Ensure your system's CA certificates are up to date
- Verify you're using HTTPS (not HTTP) for production
- Check system clock is synchronized
- For development, you can temporarily disable SSL verification (not recommended for production)
Rate Limiting
Rate Limit Exceeded
Error:
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 60 seconds.",
"type": "rate_limit_error"
}
}
Solutions:
- Implement exponential backoff retry logic
- Reduce request frequency
- Cache responses when possible
- Use webhooks instead of polling
- Consider upgrading to higher rate limits (contact support)
Settlement Issues
Settlement Failed
Symptom: Payment confirmed but settlement status shows FAILED
Solutions:
- Check settlement destination is valid
- Verify settlement method is correct
- Check merchant account status
- Review settlement logs for details
- Contact support if issue persists
Settlement Not Initiated
Symptom: Payment is SUCCEEDED but settlement hasn't started
Solutions:
- Wait a few moments (settlement is asynchronous)
- Check if settlement job is queued
- Verify
settlementMethodis set correctly - Ensure
settlementDestinationis provided
Blockchain Issues
Transaction Not Confirmed
Symptom: Payment stuck in PROCESSING status
Solutions:
- Check blockchain transaction status directly
- Verify transaction hash is correct
- Check network congestion (may take longer during high traffic)
- Ensure transaction has enough gas
- Wait for required confirmations (5+)
Wrong Network
Symptom: Transactions failing or not appearing
Solutions:
- Verify you're connected to the correct network (Sepolia for test)
- Check chain ID matches the payment intent
- Ensure your wallet is on the correct network
- Verify contract addresses match the network
Common Integration Mistakes
1. Not Handling Errors
Problem: Errors crash the application
Solution: Always wrap API calls in try-catch blocks
try {
const intent = await apiRequest('/payment-intents', {...});
} catch (error) {
// Handle error gracefully
console.error('Payment creation failed:', error);
}
2. Not Polling for Status Updates
Problem: Payment status not updated in UI
Solution: Implement polling or use webhooks
const pollStatus = setInterval(async () => {
const intent = await apiRequest(`/payment-intents/${intentId}`);
if (intent.data.status === 'SUCCEEDED') {
clearInterval(pollStatus);
updateUI(intent);
}
}, 5000);
3. Hardcoding API Keys
Problem: API keys exposed in code
Solution: Use environment variables
const API_KEY = process.env.FINTERNET_API_KEY; // ✅ Good
const API_KEY = 'sk_test_123...'; // ❌ Bad
4. Not Validating Responses
Problem: Assuming responses are always successful
Solution: Always check response status
const response = await fetch(endpoint, options);
if (!response.ok) {
const error = await response.json();
throw error;
}
Debugging Tips
Enable Logging
Log all API requests and responses during development:
async function apiRequest(endpoint: string, options: RequestInit = {}) {
console.log('Request:', endpoint, options);
const response = await fetch(endpoint, options);
const data = await response.json();
console.log('Response:', data);
return data;
}
Check Request Headers
Verify headers are set correctly:
console.log('Headers:', {
'X-API-Key': API_KEY,
'Content-Type': 'application/json',
});
Validate Request Body
Ensure request body matches API requirements:
const body = {
amount: '100.00',
currency: 'USDC',
// ... other fields
};
console.log('Request body:', JSON.stringify(body, null, 2));
Getting Help
If you're still experiencing issues:
- Check Documentation: Review relevant guides and API reference
- Review Error Messages: Error codes provide specific information
- Check Logs: Review application and API logs for details
- Contact Support:
- Email: support@finternet.com
- Include: Error message, API key (test key), request details, response