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 paymentsPublic Profile
- handle, displayName, & avatarUrlPrivate Profile
- email & phoneNumberFriends
- friends listSign
- sign dataRun
- 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);
Updated 2 months ago