Slyk
  • Introduction
  • Understanding Slyk
    • Before you Start
    • Core Concepts
    • Funding/Withdrawal Methods
  • Developing with Slyk
    • Step-by-step development guide
      • Authentication
      • Wallet
      • Catalog
      • Checkout (coming soon)
      • Growth tools (coming soon)
    • SDKs
      • Server SDK (Node.js)
        • Methods
      • Third party SDK's
  • API Reference
    • Using your API Key
    • Endpoints
      • Wallet
      • Transaction
      • Address
      • Asset
      • Rate
      • PaymentMethod
      • Movement
      • User
      • Invite
      • Category
      • Order
      • Product
      • Question
      • Task
      • TaxRate
    • Webhooks
      • Store
      • Transaction
      • User
    • Models
  • Setup Guides
    • PayPal Configuration
      • Verifying webhook
      • Webhook configuration
    • Stripe Configuration
      • Verifying endpoints
    • Coinbase Configuration
Powered by GitBook
On this page
  • Demo Application
  • Create a new API Key
  • Using the Slyk Node SDK
  • Serializing Slyk SDK models

Was this helpful?

  1. Developing with Slyk

Step-by-step development guide

PreviousFunding/Withdrawal MethodsNextAuthentication

Last updated 2 years ago

Was this helpful?

This guide will cover what you need to know to get started on building your application on top of the Slyk API using our . The use case followed here is wanting to build a product that leverages a community built with Slyk, meaning that the application will use Slyk's user management as well as its e-commerce and reward systems. While it is possible to have your product manage its own users, outside of Slyk, that will not be covered on this guide.

The first thing you'll need to do is create an API key on your Slyk dashboard. You can see how that is done on the first step of the quick start guide.

Keep in mind that building an application that uses the Slyk API requires a bit of backend development. This is because you'll want to keep your Slyk API key secure, and not include it on your frontend code. The part of your application that connects with the Slyk API should then be on the backend.

This guide uses as the framework to build the examples, because it allows creating API routes, which is where we'll write the integration with the Slyk API.

Demo Application

The code in this guide is also the base for the open source demo application. Its source is available here:

If you want to see it working right away, you can try our. Balances and checkout are fake and are only meant be used for testing purposes only.

Create a new API Key

  1. Go to your Slyk dashboard.

  2. On the main menu, go to Credentials and click on the CREATE NEW API KEY button.

Using the Slyk Node SDK

Install the Slyk Node SDK package with:

npm install @slyk/slyk-sdk-node

Or with:

yarn add @slyk/slyk-sdk-nodea

Then you'll need a way to configure the API key you created. We advise using environment variables for this. In Next.js you can do so with a .env file, which would look like this:

SLYK_API_KEY=your-api-key

The name you give this environment variable is up to you.

With this set up, you should be able to access it on your code. You'll then need to create an instance of the Slyk SDK, like this:

import createSlykClient from '@slyk/slyk-sdk-node';

const slyk = createSlykClient({ apikey: process.env.SLYK_API_KEY });

You're now ready to start using the Slyk API.

Serializing Slyk SDK models

JSON.parse(JSON.stringify(user));

Keep that in mind when getting data from the Slyk API using the Slyk SDK.

For more information on the Slyk Node SDK take a look at its .

The getServerSideProps method in Next.js , so it's necessary to serialize model instances returned by the Slyk SDK manually. This can be done with JSON.stringify and JSON.parse for example, like this:

documentation
requires all returned values to be serializable
Node SDK
Next.js
https://github.com/slykio/slyk-demo
Live Demo