LogoLogo
  • Home
  • Overview
  • Getting Started
  • Prompt Guide
  • API Reference
    • Authentication
      • Web3
      • Google OAuth
    • Account
    • Escrow
    • File upload
    • Wallet
Powered by GitBook
On this page
Export as PDF
  1. API Reference

Escrow

This section explains a crucial part of the API: escrow, including how they can be defined, structured, grouped, and categorized.

PreviousAccountNextFile upload

Last updated 4 days ago

The following services can create, validate, and release escrow.

Create Escrow
Validate Escrow
Release Escrow Funds
List Supported Cryptocurrencies
Get Blockchain RPC Configuration

List Supported Cryptocurrencies

get

This endpoint retrieves the complete list of cryptocurrencies and tokens supported by the platform for payment processing, wallet transactions, and financial operations. The response includes detailed information about each cryptocurrency, including its identification, technical specifications, and visual representation.

Request

This is a straightforward GET request that doesn't require any parameters or request body. Authentication is typically required to access this endpoint.

Response

The response begins with standard status indicators that provide immediate feedback about the API call:

  • status: Indicates the result of the operation, showing "success" when the request is processed successfully

  • message: A human-readable message describing the result, typically "OK" for successful operations

  • data : Array containing detailed information about each supported cryptocurrency. For each cryptocurrency, the following information is provided:

  • _id: A unique system identifier for the cryptocurrency within the platform's database. This identifier is used internally for referencing the cryptocurrency in transactions, preferences, and other related operations.

  • name: The full, official name of the cryptocurrency as it should be displayed to users in interfaces and communications. This field helps users clearly identify the cryptocurrency when making transaction decisions.

  • symbol: The abbreviated ticker symbol that represents the cryptocurrency on exchanges and in financial contexts. The symbol is frequently used in price displays, transaction histories, and other compact representations.

  • reference: A slug-style identifier that serves as a human-readable reference for the cryptocurrency, useful for URLs, filtering, and API parameters.

  • icon: A URL pointing to the official logo or icon image for the cryptocurrency. This image resource allows applications to display recognizable visual identifiers alongside the cryptocurrency name and symbol.

  • contractAddress: The blockchain address where the token's smart contract is deployed. This address is crucial for interacting with the token on its native blockchain, allowing for transaction validation and balance verification.

  • decimal: The number of decimal places supported by the cryptocurrency, defining the smallest fraction of the token that can be transacted. This information is essential for proper amount calculations and display formatting.

  • isToken: A boolean flag indicating whether the cryptocurrency is a token built on an existing blockchain (true) or a native blockchain currency (false).

  • rpcChainId: The chain identifier for the blockchain network where the token operates. This ID is used for connecting to the appropriate blockchain RPC endpoint for transactions.

  • active: A boolean flag indicating whether the cryptocurrency is currently active and available for use on the platform. Inactive cryptocurrencies might be temporarily suspended or phased out.

  • createdAt: The timestamp when the cryptocurrency was first added to the platform's supported list. This helps track the chronology of supported cryptocurrencies and may be relevant for historical analysis.

  • updatedAt: The timestamp when the cryptocurrency's information was last modified. This helps track when specifications or details were changed.

Authorizations
Responses
200
OK
application/json
Responseobject
get
GET /v1/payment/coins HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "status": "success",
  "message": "OK",
  "data": [
    {
      "_id": "6712a26099fd81f408b39cf1",
      "name": "COQ INU",
      "symbol": "COQ",
      "icon": "https://chainsite-dev-storage.s3.us-east-1.amazonaws.com/1711017420048_coqinu.png",
      "reference": "coq-inu",
      "contractAddress": "0x2a0cB38ACB2715e47B97d185B39F4f7f7B4B51C3",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-18T18:01:04.959Z",
      "updatedAt": "2024-10-18T18:01:04.959Z",
      "__v": 0
    },
    {
      "_id": "6712a26099fd81f408b39ced",
      "name": "JOE",
      "symbol": "JOE",
      "icon": "https://chainsite-dev-storage.s3.us-east-1.amazonaws.com/1711033239974_trader_joe.webp",
      "reference": "joe",
      "contractAddress": "0x8eDB919eCF14a5019ddb8DbeBF148D0893Acbe1A",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-18T18:01:04.953Z",
      "updatedAt": "2024-10-18T18:01:04.953Z",
      "__v": 0
    },
    {
      "_id": "6712a26099fd81f408b39ce8",
      "name": "BENQI",
      "symbol": "QI",
      "icon": "https://chainsite-dev-storage.s3.us-east-1.amazonaws.com/1710951727857_BENQI_logo.jpeg",
      "reference": "benqi",
      "contractAddress": "0x5192dd2AF7f79a964b982aF8C3e07F55Dc4030d7",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-18T18:01:04.944Z",
      "updatedAt": "2024-10-18T18:01:04.944Z",
      "__v": 0
    },
    {
      "_id": "6712a26099fd81f408b39ce4",
      "name": "Avalaunch",
      "symbol": "XAVA",
      "icon": "https://chainsite-dev-storage.s3.us-east-1.amazonaws.com/1711016878037_avalaunch.webp",
      "reference": "avalaunch",
      "contractAddress": "0xB1262c2DC22232200406C4b8dbd56868A697a703",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-18T18:01:04.938Z",
      "updatedAt": "2024-10-18T18:01:04.938Z",
      "__v": 0
    },
    {
      "_id": "6712a26099fd81f408b39ce0",
      "name": "GOGOPOOL",
      "symbol": "GGP",
      "icon": "https://chainsite-dev-storage.s3.us-east-1.amazonaws.com/1711015451773_gogopool.png",
      "reference": "gogopool",
      "contractAddress": "0x2F512fD339E36Cf6744e311900c494dFD7B4B133",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-18T18:01:04.930Z",
      "updatedAt": "2024-10-18T18:01:04.930Z",
      "__v": 0
    },
    {
      "_id": "66fb498c9e1d33779aec8b8e",
      "name": "TECH",
      "symbol": "TECH",
      "icon": "https://s3.amazonaws.com/chainsite-dev-storage/1715205847967_tech_coin.png",
      "reference": "tech",
      "contractAddress": "0x2a0cB38ACB2715e47B97d185B39F4f7f7B4B51C3",
      "decimal": "18",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-10-01T00:59:56.195Z",
      "updatedAt": "2024-10-01T00:59:56.195Z",
      "__v": 0
    },
    {
      "_id": "66fabd5d0f3ed134f11ec733",
      "name": "USDC",
      "symbol": "USDC",
      "icon": "https://chainsite-dev-storage.s3.amazonaws.com/icons/usdc.svg",
      "reference": "usdc",
      "contractAddress": "0x5425890298aed601595a70AB815c96711a31Bc65",
      "decimal": "6",
      "isToken": true,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-09-30T15:01:49.004Z",
      "updatedAt": "2024-09-30T15:01:49.004Z",
      "__v": 0
    },
    {
      "_id": "66fabd5c0f3ed134f11ec72e",
      "name": "AVAX",
      "symbol": "AVAX",
      "icon": "https://chainsite-dev-storage.s3.amazonaws.com/icons/avax.svg",
      "reference": "avax",
      "decimal": "6",
      "isToken": false,
      "rpcChainId": "43113",
      "active": true,
      "createdAt": "2024-09-30T15:01:48.994Z",
      "updatedAt": "2024-09-30T15:01:48.994Z",
      "__v": 0
    }
  ]
}

Get Blockchain RPC Configuration

get

This endpoint retrieves information about a Remote Procedure Call (RPC) configuration for blockchain interactions.

The endpoint returns configuration details for connecting to a specific blockchain network.

Request

No parameters are required for this request.

Response

The response contains comprehensive details about the RPC configuration:

Status Information

The response begins with status indicators that confirm whether the request was successful.

  • status: Indicates the outcome of the request. A value of "success" means the request was processed without errors.

  • message: Provides additional context about the request result. "Success" confirms that the operation completed as expected.

RPC Configuration Data

The main payload is contained within the "data" field, which includes:

  • _id: A unique identifier for this RPC configuration in the database. This is formatted as a MongoDB ObjectId.

  • rpcName: The human-readable name of the blockchain network. In this case, "Avalanche Testnet C-Chain" identifies this as the Contract Chain testnet environment for the Avalanche network.

  • rpcChainId: The numeric identifier for the blockchain network. The value "43113" specifically identifies the Avalanche Testnet C-Chain. This chain ID is essential for wallet connections to ensure users are connected to the correct network.

  • rpcUrls: An array of endpoint URLs that can be used to connect to the blockchain network.

  • blockExplorerUrls: An array of URLs pointing to block explorers for this network.

  • rpcNativeCurrency: Details about the native currency of the blockchain:

    • name: The full name of the currency

    • symbol: The ticker symbol for the currency

    • decimals: The number of decimal places supported by the currency, which determines the smallest divisible unit

  • active: A boolean flag indicating whether this RPC configuration is currently active and available for use.

  • createdAt: The timestamp when this RPC configuration was created in the database.

  • updatedAt: The timestamp when this RPC configuration was last modified.

Usage

This endpoint can be used to dynamically configure blockchain connections in applications.

The returned information provides all necessary details to establish a connection to the blockchain, verify transactions through the block explorer, and understand the native currency specifications.

Authorizations
Responses
200
OK
application/json
Responseobject
get
GET /v1/payment/rpc HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "status": "success",
  "message": "Success",
  "data": {
    "_id": "66fabd5c0f3ed134f11ec727",
    "rpcName": "Avalanche Testnet C-Chain",
    "rpcChainId": "43113",
    "rpcUrls": [
      "https://api.avax-test.network/ext/bc/C/rpc"
    ],
    "blockExplorerUrls": [
      "https://cchain.explorer.avax-test.network"
    ],
    "rpcNativeCurrency": {
      "name": "Avalanche",
      "symbol": "AVAX",
      "decimals": "18"
    },
    "active": true,
    "createdAt": "2024-09-30T15:01:48.967Z",
    "updatedAt": "2024-09-30T15:01:48.990Z",
    "__v": 0
  }
}
  • POSTCreate Escrow
  • POSTValidate Escrow
  • POSTRelease Escrow Funds
  • GETList Supported Cryptocurrencies
  • GETGet Blockchain RPC Configuration

Create Escrow

post

The endpoint initiates a new escrow with the provided details.

Request

Send an HTTP POST request to {{baseUrl}}/v1/escrow/initiate with the following payload in the raw request body:

  • title: (string) Title of the escrow

  • description: (string) Description of the escrow

  • amount: (number) Amount of the escrow

  • coin: (string) Type of coin for the escrow

  • dueDate: (string) Due date for the escrow in the format 'YYYY-MM-DD'

  • isPrivate: (boolean) Indicates if the escrow is private

  • isFundingRequest: (boolean) Indicates if the escrow is a funding request

  • receiverId: (string) ID of the receiver for the escrow

Response

The response contains a status field to indicate the status of the request, a message field for any additional information, and a data object with the following attributes:

  • coin: The type of coin involved in the escrow.

  • address: The address related to the escrow.

  • escrowAmount: The total escrow amount.

  • coinEscrowAmount: The escrow amount in the specified coin.

  • expectedFee: The expected fee for the escrow.

  • amountToPay: The amount to be paid.

  • usdFee: The fee amount in USD.

  • usdAmount: The amount in USD.

  • feePercentage: The percentage of the fee.

  • rate: The exchange rate.

  • chainId: The chain ID related to the escrow.

  • contractAddress: The contract address related to the escrow.

  • paymentMethods: An array of available payment methods.

  • collectionId: The ID associated with the collection.

Authorizations
Body
objectOptionalExample: {"title":"Third Escrow Test","description":"Testing the escrow flow","amount":10,"coin":"usdc","dueDate":"2030-01-01","isPrivate":false,"isFundingRequest":false,"receiverId":"66fbc91b9e1d33779aec8e80"}
Responses
200
OK
text/plain
Responsestring
post
POST /v1/escrow/initiate HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 201

{
  "title": "Third Escrow Test",
  "description": "Testing the escrow flow",
  "amount": 10,
  "coin": "usdc",
  "dueDate": "2030-01-01",
  "isPrivate": false,
  "isFundingRequest": false,
  "receiverId": "66fbc91b9e1d33779aec8e80"
}
200

OK

{
    "status": "success",
    "message": "OK",
    "data": {
        "coin": "usdc",
        "address": "0x2722c4e54b2082f83fd0ff479c15ccafcb8a0ce7",
        "escrowAmount": 100,
        "coinEscrowAmount": 100,
        "expectedFee": 1.01,
        "amountToPay": 101.01,
        "usdFee": 1.01,
        "usdAmount": 99.99,
        "feePercentage": 1,
        "rate": 0.999946,
        "chainId": "43113",
        "contractAddress": "0x5425890298aed601595a70AB815c96711a31Bc65",
        "paymentMethods": [
            "crypto",
            "stripe"
        ],
        "collectionId":"67fc1d39e35e13aedadd0717"
    }
}

Validate Escrow

post

This endpoint makes an HTTP POST request to validate an escrow collection.

Request

  • escrowId (string): The ID of the escrow to be validated.

Response

  • status (string): The status of the response.

  • message (string): Any additional message related to the response.

  • data (object): The data object containing various properties related to the validated escrow collection.

    • escrowId (string): The ID of the validated escrow.

    • paymentAmount (number): The amount of payment for the validated escrow.

    • paymentAddress (string): The payment address for the validated escrow.

    • receiverId (string): The ID of the receiver for the validated escrow.

    • status (string): The status of the validated escrow.

Authorizations
Body
objectOptionalExample: {"escrowId":"67fd70faedb5a6dcc87170cb"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/escrow/validate HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 39

{
  "escrowId": "67fd70faedb5a6dcc87170cb"
}
200

OK

{
  "status": "success",
  "message": "Payment has already been made",
  "data": {
    "escrowId": "67fd70faedb5a6dcc87170cb",
    "paymentAmount": 10,
    "paymentAddress": "0x9fe5e24e85622514a163ac166f155eb4b1d933f5",
    "receiverId": "66fbc91b9e1d33779aec8e80",
    "status": "waiting"
  }
}

Release Escrow Funds

post

This endpoint is used to release a payment with the provided escrowId.

Request

  • escrowId (string): The ID of the escrow to release the payment for.

Response

The response body will have the following attributes:

  • status (string): Indicates the status of the payment release process.

  • message (string): Provides any additional information or error messages related to the payment release.

  • data (object): Contains the data related to the released payment, if applicable.

Authorizations
Body
objectOptionalExample: {"escrowId":"67f915a46960ad4ffdaefbdf"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/escrow/release HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 39

{
  "escrowId": "67f915a46960ad4ffdaefbdf"
}
200

OK

{
  "status": "success",
  "message": "Payment Released",
  "data": {}
}