Make your first payment

Install the SDK module to your project:

npm install --save @handcash/handcash-connect

Import the module and initialize using the App ID and App Secret:

const {HandCashConnect} = require('@handcash/handcash-connect');
const handCashConnect = new HandCashConnect({ 
   appId: '<app-id>', 
   appSecret: '<secret>',

Generate the OAuth URL and redirect the user:

const redirectionLoginUrl =  handCashConnect.getRedirectionUrl();

After the user has granted permissions to your app, they will be redirected to the authentication success you have set in the developer dashboard.

Initialize the user's cloud account using authToken:

const account = handCashConnect.getAccountFromAuthToken(<authToken>);


See our authorization page for a full guide on how to obtain the authToken.

Get user profile:

const { publicProfile } = await account.profile.getCurrentProfile();

console.log(`Hey ${publicProfile.handle}, welcome to my app!`);

Make a payment:

const payParameters = {
      payments: [{ destination: 'nosetwo', currencyCode: 'USD', sendAmount: 0.10 }]

Did this page help you?