fortispay-typescript-sdk
v1.0.16
Published
Fortispay Typescript SDK
Maintainers
Readme
Getting Started with Fortis API
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | Environment | The API environment. Default: Environment.Sandbox |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| userIdCredentials | UserIdCredentials | The credential object for userId |
| userApiKeyCredentials | UserApiKeyCredentials | The credential object for userApiKey |
| developerIdCredentials | DeveloperIdCredentials | The credential object for developerId |
| accessTokenCredentials | AccessTokenCredentials | The credential object for accessToken |
The API client can be initialized as follows:
Code-Based Client Initialization
import { Client, Environment } from 'fortispay-typescript-sdk';
const client = new Client({
userIdCredentials: {
'user-id': 'user-id'
},
userApiKeyCredentials: {
'user-api-key': 'user-api-key'
},
developerIdCredentials: {
'developer-id': 'developer-id'
},
accessTokenCredentials: {
'access-token': 'access-token'
},
timeout: 0,
environment: Environment.Sandbox,
});Configuration-Based Client Initialization
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'fortispay-typescript-sdk';
// Provide absolute path for the configuration file
const absolutePath = path.resolve('./config.json');
// Read the configuration file content
const fileContent = fs.readFileSync(absolutePath, 'utf-8');
// Initialize client from JSON configuration content
const client = Client.fromJsonConfig(fileContent);See the Configuration-Based Client Initialization section for details.
Environment-Based Client Initialization
import * as dotenv from 'dotenv';
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'fortispay-typescript-sdk';
// Optional - Provide absolute path for the .env file
const absolutePath = path.resolve('./.env');
if (fs.existsSync(absolutePath)) {
// Load environment variables from .env file
dotenv.config({ path: absolutePath, override: true });
}
// Initialize client using environment variables
const client = Client.fromEnvironment(process.env);See the Environment-Based Client Initialization section for details.
Environments
The SDK can be configured to use a different environment for making API calls. Available environments are:
Fields
| Name | Description | | --- | --- | | Sandbox | Default | | Production | - |
Authorization
This API uses the following authentication schemes.
user-id (Custom Header Signature)user-api-key (Custom Header Signature)developer-id (Custom Header Signature)access-token (Custom Header Signature)
List of APIs
- Async Processing
- Declined Recurring Transactions
- Device Terms
- Full Boarding
- 3 DS Authentication
- 3 DS Transactions
- Merchant Deposits
- Enterprise Link Redirect
- On Boarding
- Payment Card Reader Token
- Calculate Surcharge
- Quick Invoices
- Transaction ACH Retries
- Transactions-ACH
- Transactions-Cash
- Transactions-Credit Card
- Transactions-EBT Card
- Transactions-Read
- Level 3 Data
- Transactions-Updates
- Apple Pay Validate Merchant
- Merchant Details
- Batches
- Contacts
- Elements
- Locations
- Paylinks
- Recurring
- Reports
- Signatures
- Tags
- Terminals
- Tickets
- Tokens
- Webhooks
SDK Infrastructure
Configuration
- HttpClientOptions
- RetryConfiguration
- ProxySettings
- Configuration-Based Client Initialization
- Environment-Based Client Initialization
