Getting Started

Learn how to easily integrate HandCash SSO, Payments, and NFTs into your application.

Registration

To get started with Connect, register your app through the developer dashboard.

πŸ“˜

Credentials

Once you've registered the app, be sure to copy down your App ID and App Secret; also take special note of your Success URL.


Permissions

During the registration, you will be asked to select permissions that will be required by your app. Below are the available permissions:

  • Pay - trigger payments
  • Public Profile - handle, displayName, & avatarUrl
  • Private Profile - email & phoneNumber
  • Friends - friends list
  • Sign - sign data
  • Run - Power your apps using a modular token language.

πŸ‘

Public Profile is enabled by default for all Applications


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 }]
  };    
    
  await account.wallet.pay(payParameters);

What’s Next

See how to authenticate users.

Did this page help you?