Registration
To get started with Connect, you will need to register your app through the HandCash developer dashboard.
Permissions
During the registration, you will be asked to select permissions that will be required by your app. Below are all the available permissions:
PublicProfile
is enabled by default for all applications.
Initialize the SDK
Install the SDK module to your project:
npm install --save @handcash/handcash-connect
Import the module and initialize:
const {HandCashConnect} = require('@handcash/handcash-connect');
const handCashConnect = new HandCashConnect('<app-id>');
Generate the oauth url:
const redirectionLoginUrl = handCashConnect.getRedirectionUrl();
Initialize the user’s cloud account:
const account = handCashConnect.getAccountFromAuthToken(token);
This must be initialized using the authToken from the earlier authorization. See our authorization page for a full walkthrough.
View user profile:
const { publicProfile } = await account.profile.getCurrentProfile();
console.log(`Hey ${publicProfile.handle}, welcome to HandCash Connect!`);
Make a payment:
const payParameters = {
payments: [{ destination: 'nosetwo', currencyCode: 'USD', sendAmount: 0.25 }]
};
await account.wallet.pay(payParameters);
Explore our documentation for more features!
In the next section, we’ll be prompting the user for authorization.