Tezro Open API Integration Instructions


Sing up to Tezro

A store or merchant need to create a user account inside the Tezro client.

Instructions:

  1. Launch Tezro client
  2. Sign up for a user account (Skip if a Tezro account has already been created)
  3. Go to the setup screen
  4. Click on External Shop
  5. Specify: Name of your store, URL address of your store, webhook URL for receiving information from Tezro on your transactions.
  6. After Sign Up, App ID, Key ID, Secret Key, and service EOS Account will be displayed

Definitions

App ID - Application ID in Tezro. Issued when registering a store
Key ID - Key ID in Tezro. Issued when registering a storeSecret Key - API authorization key
X-Tezro -Signature - HMAC SHA-512 - a signature signed by the Secret Key issued along with the AppID and KeyID
EOS Account - an account address to which funds are received from buyers
Timestamp - Current time with UNIX Timestamp in milliseconds

Connecting a widget to an external store

Use widget script

Webhook URL

When registering a store, you can set the URL which will receive the transactions for the order that will need to be fulfilled.Details Transaction details will be sent to the specified URL. The request body consists of an instance of the TransactionDto class.If you receive a response with an http status outside the 200-299 range, the request will be sent again after a while. After 5 attempts, this request will be postponed and moved to the archive. A store can get the details of this transaction among other transactions, as described in the Transaction History section.

Authorization of requests

To get the transaction history (Request for the transaction history and request for a transaction by transaction ID), add the following headers to requests:

  • AppID
  • KeyID
  • X-Tezro-Signature
  • Timestamp

Example of the creation of X-Tezro-Signature в NodeJS

const {createHmac} = require('crypto');

const data = req.path; // Request url path. e.g.: '/api/v1/transactions'
const secret = 'YOUR_SECRET_KEY' // Keep it safe! 
const X_Tezro_Signature = createHmac('sha512',secret) 
 .update(data) 
 .digest('base64');

Transaction history

An external store can retrieve the transaction history for all of its orders, either by the transaction ID or by the order ID. The request requires authorization.


Query with default parameters

curl -X GET "https://dev-openapi.tezro.com/api/v1/transactions" -H "accept: application/json" -H "AppID: YOUR_APP_ID" -H "KeyID: YOUR_KEY_ID" -H "X-Tezro-Signature: QUERY_SIGNATURE" -H "Timestamp: 1605348982000" 

Query with set parameters

curl -X GET "https://dev-openapi.tezro.com/api/v1/transactions?offset=10&limit=10&sort=1" -H "accept: application/json" -H "AppID: YOUR_APP_ID" -H "KeyID: YOUR_KEY_ID" -H "X-Tezro-Signature: QUERY_SIGNATURE" -H "Timestamp: 1605348982000" 

Sample resnoses:

Reply with 401 status (not authorized)

{
 “statusCode”: 401,
 “message”: “Unauthorized”
}

Reply with 200 status (successful)

{
 “pagination”: {
  “offset”: 0,
  “count”: 1,
  “total”: 1,
  “prev”: false,
  “next”: false
},
 “transactions”: [
 {
  “txId”: “string”,
  “status”: “string”,
  “amount”: “string”,
  “symbol”: “string”,
  “from”: “string”,
  “to”: “string”,
  “memo”: “{\”type\”:\”externalShop\”,\”orderId\”:\”123”}”,
  “date”: 1605172239,
  “address”: {
    “id”: “AddressId”,
    “address”: “Full address”,
    “city”: “City”,
    “region”: “Region”,
    “country”: “Country”,
    “postal”: “postal”
   }
  }
 ]
}

Transaction request by transaction ID

Returns the transaction at the specified ORDER_ID

curl -X GET "https://dev-openapi.tezro.com/api/v1/transactions/order/12345" -H "accept: application/json"

Reply with 200 status

{
 "txId": "string", 
 "status": "string", 
 "amount": "string", 
 "symbol": "string", 
 "from": "string", 
 "to": "string", 
 "memo": "{\"type\":\"externalShop\",\"orderId\":\"123\"}", 
 "date": 1605172239, 
 "address": 
 { 
  "id": "AddressId",
  "address": "Street House Apartment", 
  "city": "City", 
  "region": "Region",
  "country": "Country", 
  "postal": "Postal" 
 } 
} 

Send message to buyer
Request to send a message to the buyer on the Tezro client

curl -X POST "https://dev-openapi.tezro.com/api/v1/messages/{orderId}" -H "accept: application/ json" -H "AppID: YOUR_APP_ID" -H "KeyID: YOUR_KEY_ID" -H "X-Tezro-Signature: YOUR_REQUEST_SIGNATURE" -H "Timestamp: 1605348982000"

{
 “message”: “Hello, dear customer!”,
 “entities”: [
  {
      type: 'text_url',
      offset: number, // start index of placeholder text
      length: number,  // length of placeholder text
      url: 'https://tezro.com' // placeholder’s url
    }
 ]
}

Reply with 201 status

true

Data types

TransactionsDto

List of transactions

Field Type Description
pagination HttpPaginationDto Pagination details
transactions TransactionDto[] List of transactions. Array

HttpPaginationDto

Transaction List Pagination Details

Field Type Description
offset number How many elements, starting with the 1st, are missing in the answer
count number The number of items in the list with the answers
total number Total number of items in the list
prev boolean Previous page
next boolean Next page

TransactionDto

Transaction

Field Type Description
txId string Transaction id
status SUCCESS | FAIL | PROCESSING Transaction status
amount string Transaction size
symbol string Transaction currency (EOSORIG | ETH | BTC | USDT | EURT | CNHT | XAUT | USD | EUR | CNY)
from string eos buyer's account
to string Service eos merchant account
memo string Details for the transaction. Example: "{\"type\":\"externalShop\",\"orderId\":\"123\"}"
date number Transaction time in seconds (UNIX time)
address Address Optional. Order delivery address

Address

Delivery address details

Field Type Description
id string Unique address identifier
address string Local delivery
city string City
region string Region
country string Country
postal string Index
geo GeoPoint | null Geolocation

GeoPoint

Delivery address geodata

Field Type Description
lat number Latitude. Example: 56.477956
lon number Longitude. Example: 84.965033