Managing Tokens

You can add and manage Tokens via the Developer Console and via the API!

Managing Tokens through the Developer Console

Adding an NFT Collection via the Developer Console only requires 3 steps:

Step 1: Go to the Tokens page in the Developer Console

Click on the "Tokens" button on the left panel in the Developer Console.

Step 2: Click "Add Token"

Click "Add Token" button, a popup will let you add the information of your contract:

  • Collection name

  • Contract address

  • Choose blockchain

  • Choose the token standard

When you finish, click on the "Save" button.

Step 3: List your NFT or In-Platform Token using Tweed's SDK function

Use the following SDK function to list your collection:

sdk.nft.buyWithFiat(...)

Head to buyWithFiat for an example on how to use this function.

Once you've completed setup, you can start selling your NFTs and Tokens! 🎉


Manage Tokens using the API

This feature allows you to seamlessly add and manage NFTs or In-Platform Tokens outside of the Developer Console by utilizing our powerful REST API. With this functionality, you can easily integrate NFTs or In-Platform Token management into your own applications or systems.

Step 1: Get the API Key and Secret

In the Tokens page of the Developer Console, click on the "Add Tokens via API" button. If it's the first time, click the "Generate API Keys" button.

Step 2: Obtain JWT Access Token

To obtain a JWT access token, send a POST request to the https://api-console.paytweed.com/auth/getAccessToken endpoint. Include your API key and API secret in the request body. This will return a JWT access token.

🚨 Create a mechanism in your code to generate a new JWT token only when the current token has expired, rather than generating a new token for each API call.

curl --request POST --header "Content-Type: application/json" --data '{"apiKey":"<YOUR_API_KEY>","apiSecret":"<YOUR_API_SECRET>"}' https://api-console.paytweed.com/auth/getAccessToken

const apiKey = 'your_api_key';
const apiSecret = 'your_api_secret';

const authEndpoint = 'https://api-console.paytweed.com/auth/getAccessToken';

const payload = {
  apiKey,
  apiSecret,
};

const response = await fetch(authEndpoint, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload),
});

const jwt = await response.json();
Step 3: Include JWT Token in API Requests​

For each API call you make to the https://api-console.paytweed.com/collections endpoint, include the JWT token in the header of your request. This ensures that the server can authenticate and authorize your requests properly.

const headers = {
  Authorization: `Bearer ${access_token}`,
  'Content-Type': 'application/json',
};

// Make API requests using the 'headers' object in your requests

Now you can make API calls to the https://api-console.paytweed.com/collection endpoint to manage your NFTs and Tokens! 🎉


Add a New Token

Send a POST request to the https://api-console.paytweed.com/collections endpoint, including an array of objects that represent the details of the NFT collection or In-Platform Token.

The required properties for each object are:

name /Required

Type: String

Description: The name of the NFT Collection or In-Platform Token

Best practice: Try to keep names short so the full name will appear in every modal

blockchain /Required

Type: String

Description: The name of the blockchain associated with the NFT Collection or In-Platform Token

See all the supported blockchains in Supported Blockchains.

contractAddress /Required

Type: String

Description: The address of the smart contract associated with the NFT Collection or In-Platform Token

whitelisted /Required

Type: String

Description: A boolean value indicating if the NFT Collection or In-Platform Token is whitelisted

whitelistingInfo /Required

Type: String

Description: Additional information about the whitelisted status

const tokens = [
    {
      name: 'Collection 1',
      contractAddress: '0x123456789',
      blockchain: 'Ethereum',
      whitelisted: false,
      whitelistingInfo: '{}'
    },
    {...another token}]

Ensure that all of these properties are included in your request.


Retrieve Your Tokens

To retrieve all the NFT Collections or In-Platform Tokens in your console, send a GET request to the https://api-console.paytweed.com/collection endpoint.

The response will contain the information about all of the NFT Collections or In-Platform Tokens available.


Delete a Token

To delete a specific NFT Collection or In-Platform Token, make a DELETE request to the https://api-console.paytweed.com/collection/{token_Id} endpoint, where {token_Id} represents the ID of the NFT Collection you want to delete.

Last updated