Transações

Resumo

API responsável por monitorar o recurso de transações feitas dentro do sistema. Ela possui status pré-definidos de acordo com uma progressão cronológica e casos de cancelamento e retentativas devido à qualquer tipo de instabilidade.

Como funciona

Objeto Transaction

Exemplo de um Objeto de Transação
 "transactions": [
    {
       "id":"sef897sef",
       "userId": "w87d9a45fs",
       "item":{
          "tokenId": "f79sef456",
          "collectionId": "78sefd2s",
          "companyId": "789wease1f"
       },
       "operation": {
          "type": "buy",
          "from": "0x00001",
          "to": "0x01000"
       },
       "transactionHash": "ed784fes48es4f1fes8",
       "payment":{
          "price": "120",
          "decimals": "2"
          "currency": "ETH",
          "method": "pix",
          "priceInBrl": "685020", 
          "expiration": "05/05/2020 18:20:25"
       },
       "lastStatus": "success_send_token",
       "historyStatus": [
          {
             "date" : "05/05/2020 18:15:20",
             "status": "opened_order",
             "retries": null,
             "error": null
          },
          {
             "date" : "05/05/2020 18:15:25",
             "status": "pending_payment",
             "retries": null,
             "error": null
          },
          {
             "date" : "05/05/2020 18:17:05",
             "status": "processing_payment",
             "retries": null,
             "error": null
          },
          {
             "date" : "05/05/2020 18:17:25",
             "status": "approved_payment",
             "retries": null,
             "error": null     
          },
          {
             "date" : "05/05/2020 18:17:45",
             "status": "queue_send_token",
             "retries": null,
             "error": null
          },
          {
             "date" : "05/05/2020 18:18:30",
             "status": "success_send_token",
             "retries": null,
             "error": null         
          }
       ]
     }
  ]
}

Endpoints

  • GET /v1/transactions

  • POST /v1/transactions

  • GET /v1/transactions/:transactionId

  • PATCH /v1/transactions/:transactionId

Transações

(JWT) Lista as transações recentes do usuário logado

GET https://goblockchain.io/gotokens-api/v1/transactions

Lista informações básicas das transações recentes do usuário logado.

Nível de permissionamento necessário: qualquer

Query Parameters

Headers

{
    "transactions": [
    {
      "id":"wda8971da3w2"
      "item":{
        "tokenId": "8wad12wa3ds",
        "communityId": "8f7es7fs65",
        "companyId": "ef7sef5sef"
      },
      "operation":{
         "type": "buy",
      },
      "payment": {
        "price": "120",
        "decimals": "2",
        "currency": "ETH",
        "method": "pix",
      }
      "lastStatus": "success_send_token"
    },
    {
      "id":"2"
      "item":{
        "tokenId": "ferswad85f8",
        "communityId": "8f7es7fs65",
        "companyId": "ef7sef5sef"
      },
      "operation":{
         "type": "sell",
      },
      "payment": {
        "price": "70",
        "decimals": "2",
        "currency": "MATIC",
        "method": "credit_card",
      }
      "lastStatus": "processing_payment"
    },
  ]
}

(JWT) Cria uma nova transação

POST https://goblockchain.io/gotokens-api/v1/transactions

Nível de permissionamento necessário: sistema

Headers

Request Body

{
    "id":"sef897sef",
    "userId": "w87d9a45fs",
    "item":{
       "tokenId": "f79sef456",
       "collectionId": "78sefd2s",
       "companyId": "789wease1f"
    },
    "operation":{
       "type": "buy",
       "from": "0x00001",
       "to": "0x02002",
    },
    "payment":{
       "price": "120",
       "decimals": "2"
       "currency": "ETH",
       "method": null,
       "priceInBrl": null, 
       "expirationDate": "05/05/2020 18:20:25"
    },
    "lastStatus": "opened_order",
    "historyStatus": [
       {
          "date" : "05/05/2020 18:15:20",
          "status": "opened_order",
          "retries": null,
          "error": null
       }
    ]
}

(JWT) Lista os dados de uma transação do usuário logado

GET https://goblockchain.io/gotokens-api/v1/transactions/:transactionId

Essa requisição busca maior detalhamento em relação às transações de um usuário, trazendo todo o conteúdo associado à ela.

Nível de permissionamento necessário: qualquer

Headers

{
    "id":"sef897sef",
    "userId": "w87d9a45fs",
    "item":{
       "tokenId": "f79sef456",
       "collectionId": "78sefd2s",
       "companyId": "789wease1f"
    },
    "operation":{
       "type": "buy",
       "from": "0x00001",
       "to": "0x01000"
    },
    "transactionHash": "ed784fes48es4f1fes8",
    "payment":{
       "price": "120",
       "decimals": "2"
       "currency": "ETH",
       "method": "pix",
       "priceInBrl": "685020", 
       "expirationDate": "05/05/2020 18:20:25"
    },
    "lastStatus": "success_send_token",
    "historyStatus": [
       {
          "date" : "05/05/2020 18:15:20",
          "status": "opened_order",
          "retries": null,
          "error": null
       },
       {
          "date" : "05/05/2020 18:15:25",
          "status": "pending_payment",
          "retries": null,
          "error": null
       },
       {
          "date" : "05/05/2020 18:17:05",
          "status": "processing_payment",
          "retries": 1,
          "error": "500 Internal Server Error"
       },
       {
          "date" : "05/05/2020 18:17:25",
          "status": "approved_payment",
          "retries": null,
          "error": "500 Internal Server Error"         
       },
       {
          "date" : "05/05/2020 18:17:45",
          "status": "queue_send_token",
          "retries": null,
          "error": null         
       },
       {
          "date" : "05/05/2020 18:18:30",
          "status": "success_send_token",
          "retries": null,
          "error": null         
       }
    ]
}

(Webhook) Edita dados de uma transação

PATCH https://goblockchain.io/gotokens-api/v1/transactions/:transactionId

Nível de permissionamento necessário: sistema

Headers

Request Body

{
    "id":"sef897sef",
    "userId": "w87d9a45fs",
    "item":{
       "tokenId": "f79sef456",
       "collectionId": "78sefd2s",
       "companyId": "789wease1f"
    },
    "operation":{
       "type": "buy",
       "from": "0x00001",
       "to": "0x01000"
    },
    "transactionHash": "ed784fes48es4f1fes8",
    "payment":{
       "price": "120",
       "decimals": "2"
       "currency": "ETH",
       "method": "pix",
       "priceInBrl": "685220", 
       "expirationDate": "05/05/2020 18:20:25"
    },
    "lastStatus": "opened_order",
    "historyStatus": [
       {
          "date" : "05/05/2020 18:15:20",
          "status": "opened_order",
          "retries": null,
          "error": null
       },
       {
          "date" : "05/05/2020 18:15:25",
          "status": "pending_payment",
          "retries": null,
          "error": null
       },
    ]
}

Last updated