Getting started overview
Integrating with Real Time Finance involves a series of steps designed to get you from account creation to a successful API call. This guide focuses on the initial setup, credential management, and executing your first request, typically within the Real Time Finance Developer Sandbox environment. The sandbox allows for testing API functionality without processing live financial transactions, which is crucial for development and debugging.
The process generally includes:
- Account Creation: Registering for a Real Time Finance account.
- API Key Retrieval: Generating and securely storing your API credentials.
- Environment Setup: Configuring your development environment, potentially with an SDK.
- First API Request: Sending a basic request to verify connectivity and authentication.
- Error Handling: Understanding common error responses and troubleshooting.
Real Time Finance provides client libraries (SDKs) for Python, Node.js, Java, PHP, and Ruby to simplify interaction with their API. These SDKs handle common tasks such as authentication and request formatting.
| Step | What to do | Where |
|---|---|---|
| 1. Sign up | Create a new Real Time Finance account. | Real Time Finance homepage |
| 2. Access Dashboard | Log in to your newly created account. | Real Time Finance login page |
| 3. Generate API Keys | Navigate to the API Keys section and generate new sandbox keys. | Dashboard > Settings > API Keys |
| 4. Install SDK (Optional) | Install the appropriate SDK for your programming language (e.g., Python, Node.js). | Real Time Finance SDK documentation |
| 5. Make First Request | Send a test request using your API keys and the sandbox environment. | Real Time Finance API reference |
Create an account and get keys
To begin, you need a Real Time Finance account. The signup process is initiated from the Real Time Finance official website. During registration, you will typically provide basic business information and contact details. Once your account is created, you will gain access to the Real Time Finance Dashboard.
API keys are essential for authenticating your requests to the Real Time Finance API. Real Time Finance distinguishes between sandbox (test) and live (production) API keys. For getting started, you will use sandbox keys, which enable you to simulate transactions without affecting real funds.
Follow these steps to obtain your API keys:
- Log in to your Real Time Finance Dashboard.
- Navigate to the Settings section, usually found in the sidebar or top menu.
- Locate and click on API Keys.
- You will typically see options to view your existing keys or generate new ones. For sandbox testing, ensure you are viewing or generating Test Keys or Sandbox Keys.
- Copy your Publishable Key (often used on the client-side for tokenization) and your Secret Key (used on your server-side for authenticated API calls). The Secret Key should be treated as sensitive information and never exposed in client-side code or publicly accessible repositories.
Real Time Finance's security practices align with industry standards for handling API credentials, similar to how other payment processors manage Stripe API keys or PayPal API credentials. It is recommended to store your secret keys as environment variables or in a secure configuration management system rather than hardcoding them directly into your application.
Your first request
After obtaining your sandbox API keys, the next step is to make a test request. This verifies that your authentication is set up correctly and that your development environment can communicate with the Real Time Finance API. We will demonstrate using the Node.js and Python SDKs, which are commonly used for server-side integrations.
Using Node.js
First, install the Real Time Finance Node.js SDK:
npm install realtime-finance
Then, create a JavaScript file (e.g., test_payment.js) and add the following code. This example simulates creating a payment intent, a common first step in processing payments.
const realTimeFinance = require('realtime-finance')('YOUR_SECRET_KEY');
async function createTestPaymentIntent() {
try {
const paymentIntent = await realTimeFinance.paymentIntents.create({
amount: 1000, // Amount in cents (e.g., $10.00)
currency: 'usd',
payment_method_types: ['card'],
description: 'Test payment intent from Node.js SDK'
});
console.log('Payment Intent created successfully:');
console.log(paymentIntent);
} catch (error) {
console.error('Error creating payment intent:', error.message);
}
}
createTestPaymentIntent();
Replace 'YOUR_SECRET_KEY' with your actual Real Time Finance sandbox Secret Key. Execute the script from your terminal:
node test_payment.js
A successful response will log the details of the created payment intent. This confirms your API keys are valid and your environment is configured correctly.
Using Python
Install the Real Time Finance Python SDK:
pip install realtime-finance
Next, create a Python file (e.g., test_payment.py) and insert the following code. This example also creates a payment intent.
import realtime_finance
import os
# It's best practice to load your secret key from an environment variable
realtime_finance.api_key = os.environ.get('REALTIME_FINANCE_SECRET_KEY')
def create_test_payment_intent():
try:
payment_intent = realtime_finance.PaymentIntent.create(
amount=1000, # Amount in cents (e.g., $10.00)
currency='usd',
payment_method_types=['card'],
description='Test payment intent from Python SDK'
)
print("Payment Intent created successfully:")
print(payment_intent)
except realtime_finance.error.RealTimeFinanceError as e:
print(f"Error creating payment intent: {e}")
if __name__ == '__main__':
create_test_payment_intent()
Before running the script, set your Secret Key as an environment variable:
export REALTIME_FINANCE_SECRET_KEY='YOUR_SECRET_KEY' # For Linux/macOS
# $env:REALTIME_FINANCE_SECRET_KEY='YOUR_SECRET_KEY' # For PowerShell
python test_payment.py
A successful execution will print the payment intent object, indicating that your Python environment can authenticate and interact with the Real Time Finance sandbox.
Common next steps
Once you have successfully made your first API call, you can proceed with further integration and development. Common next steps include:
- Exploring API Endpoints: Review the Real Time Finance API reference documentation to understand the full range of available endpoints for payments, refunds, transaction monitoring, and fraud prevention.
- Implementing Webhooks: Set up webhooks to receive asynchronous notifications about events such as successful payments, failed transactions, or disputes. This is crucial for building robust, event-driven applications. Understanding webhook security, as detailed in Twilio's webhook security guide, can be beneficial.
- Handling Errors and Edge Cases: Develop comprehensive error handling logic within your application to gracefully manage API errors, network issues, and unexpected responses.
- Integrating Client-Side Elements: For payment processing, integrate client-side components (e.g., payment forms, card elements) provided by Real Time Finance or custom solutions to securely collect sensitive payment information.
- Testing with Different Scenarios: Utilize the sandbox environment to test various transaction scenarios, including successful payments, declines, refunds, and different card types.
- Moving to Production: Once your integration is thoroughly tested, switch to live API keys and endpoints. This typically involves updating your configuration with production credentials and ensuring your application is ready for live traffic.
- Monitoring and Logging: Implement monitoring and logging for your API interactions to track performance, identify issues, and ensure compliance.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some frequent problems and their solutions:
- Invalid API Key:
- Symptom: Authentication errors (e.g.,
401 Unauthorized,Invalid API Key). - Solution: Double-check that you are using the correct Secret Key, and that it is a sandbox key for sandbox environments. Ensure there are no leading or trailing spaces. Verify it's correctly loaded as an environment variable or passed to the SDK.
- Symptom: Authentication errors (e.g.,
- Network Connectivity Issues:
- Symptom: Connection timeouts or network errors.
- Solution: Check your internet connection. Ensure no firewalls or network configurations are blocking outbound requests to Real Time Finance API endpoints.
- Incorrect Endpoint or Method:
- Symptom:
404 Not Foundor405 Method Not Allowederrors. - Solution: Consult the Real Time Finance API reference to confirm the correct endpoint URL and HTTP method (e.g., POST for creating resources, GET for retrieving).
- Symptom:
- Missing or Malformed Parameters:
- Symptom:
400 Bad Requesterrors with messages indicating missing required fields or invalid data types. - Solution: Review the API documentation for the specific endpoint you are calling. Ensure all required parameters are included and their values conform to the expected format (e.g., amount in cents, valid currency codes).
- Symptom:
- SDK Configuration Errors:
- Symptom: Errors related to SDK initialization or method calls.
- Solution: Verify that the SDK is correctly installed and initialized. Refer to the Real Time Finance SDK documentation for your chosen language for specific setup instructions.
- Sandbox Environment Limitations:
- Symptom: Unexpected behavior or limitations in certain features.
- Solution: The sandbox is for testing. Some advanced features or specific transaction types might behave differently or be unavailable compared to the live environment. Always consult the Real Time Finance sandbox guide for specific details.