Installation
Install the SDK using your favorite package manager
npm install @yosle/tropipayjs yarn add @yosle/tropipayjs pnpm install @yosle/tropipayjs Initialize the Tropipay class
You can instantiate the Tropipay class passing the client_Id,
client_secret, scopes and optionally the serverMode parameter,
if no serverMode is provided, Development will be used as default.
Make sure you use the test environment credentials when serverMode is on Development.
// test environment server tropipay-dev.herokuapp.comconst config = { clientId: process.env.TROPIPAY_CLIENT_ID, clientSecret: process.env.TROPIPAY_CLIENT_SECRET, scopes: [ "ALLOW_GET_PROFILE_DATA", "ALLOW_PAYMENT_IN", "ALLOW_EXTERNAL_CHARGE", "KYC3_FULL_ALLOW", "ALLOW_GET_BALANCE", "ALLOW_GET_MOVEMENT_LIST", ], serverMode: "Development", // it will be used as default if omited};const tpp = new Tropipay(config);Using Production environment:
//real account credentialsconst config = { clientId: process.env.TROPIPAY_CLIENT_ID, clientSecret: process.env.TROPIPAY_CLIENT_SECRET, // Optionally you can request wich scopes of the credential are you gonna use. // this should be a subset of the scopes marked for this credential. // trying to use a scope that is not set for the credential will throw error // on authentication. Note: if no scopes array is passed ALL scopes are requested! scopes:[ 'ALLOW_GET_PROFILE_DATA', 'ALLOW_PAYMENT_IN', 'ALLOW_EXTERNAL_CHARGE', 'KYC3_FULL_ALLOW', 'ALLOW_GET_BALANCE', 'ALLOW_GET_MOVEMENT_LIST'] serverMode: "Production", //live account};const tpp = new Tropipay(config);