splitit-payments-sdk
v1.0.7
Published
Splitit's Installments API is the primary Splitit tool for establishing and maintaining installment plans. Use it to verify shopper eligibility, create plans with or without immediate authorization, get plan information, update plan status, and process re
Maintainers
Readme
Getting Started with splitit-web-api-v3
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.Production |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| oAuth2SandboxCredentials | OAuth2SandboxCredentials | The credential object for oAuth2Sandbox |
| oAuth2ProductionCredentials | OAuth2ProductionCredentials | The credential object for oAuth2Production |
The API client can be initialized as follows:
import {
Client,
Environment,
OAuthScopeOAuth2ProductionEnum,
OAuthScopeOAuth2SandboxEnum,
} from 'splitit-payments-sdk';
const client = new Client({
oAuth2SandboxCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret',
oAuthScopes: [
OAuthScopeOAuth2SandboxEnum.ApiV3
]
},
oAuth2ProductionCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret',
oAuthScopes: [
OAuthScopeOAuth2ProductionEnum.ApiV3
]
},
timeout: 0,
environment: Environment.Production,
});Environments
The SDK can be configured to use a different environment for making API calls. Available environments are:
Fields
| Name | Description | | --- | --- | | production | Default Sandbox | | environment2 | Production |
Authorization
This API uses the following authentication schemes.
OAuth2-sandbox (OAuth 2 Client Credentials Grant)OAuth2-production (OAuth 2 Client Credentials Grant)
