API

Utilize this robust API to effectively manage tokens for sale within your application.

Payments

Tailored for Marketplace Integration

offering you the ability to manage a fully functional marketplace. Empower your users to add their own NFTs and tokens by deploying their own smart contracts.

Leverage this API to seamlessly enable token sales with our token checkout. To access the API, simply attach a bearer token to each request. Generate this token using the management API keys provided during onboarding.

  1. 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.

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();
  1. 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',
};

Tokens and Collections

Add

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: JSON object

Description: to pass your whitelist information to my endpoint, format it as follows

Example: { "list": { "wallets": [ "0x48...0412" ] }, "emails": [ "test@test.com" ] }

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

Retrieve

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

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