{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"b99fe274-e7be-4d65-92d1-9d451ea6603d","name":"BLOX-PAYMENTS-API","description":"API to use Blox Payments API\n\nComponents to the integration to the Bloxcross API\n\n1. REST API for Requests\n    \n2. Socket API for Streaming Data & Alerts\n    \n\n**REST API**\n\n• For requests which require an immediate response  \n• Synchronous Execution  \n• Success or Failure response with Data\n\n**Socket API:**\n\n- Used to subscribe to streaming Data\n    \n- Events are pushed to the Client socket\n    \n- Two base channels: market data & alerts\n    \n\n**Client Journey**\n\nClients can Register with only basic information:\n\n- Fname, lname, email, phone, pwd, domicile, language\n    \n- Account is created but `PENDING_VERIFICATION`\n    \n- Main Portfolio is created but in `HOLD` state\n    \n\n<img src=\"https://content.pstmn.io/c28c82e7-6327-4dce-a937-297671d2954c/Q2xpZW50X0pvdXJuZXkucG5n\">\n\nClient must pass the following checks to be enables to do  \nany monetary transactions – deposit/withdraw/buy/sell:\n\n1. ID Verification\n    \n2. Verify Phone\n    \n3. Verify Email\n    \n4. Have their ID Verified, validated & do a liveness teat to make sure it is a human  \n    Pass KYC /AML\n    \n\n<img src=\"https://content.pstmn.io/05232bb6-6962-4947-a62a-cbb66412d635/VXNlcl9SZWdpc3RyYXRpb24ucG5n\">\n\n<img src=\"https://content.pstmn.io/2cd77427-ebb6-4b49-adaf-ac845a5ffe70/VXNlcl9sb2dpbi5wbmc=\">\n\n**Rest API Considerations**\n\n- Request Data in JSON Format\n    \n- Reply Data in JSON Format\n    \n- All data via HTTPS\n    \n- GET requests to return Data\n    \n- POST if any data needs to be sent to backend\n    \n- A client can have multiple sessions open at the same time\n    \n- If a client has more than one session open, then all sessions will receive notifications (socket)\n    \n\n**Socket Interface**\n\n• Use the same token generated by login to connect  \n• Session are verified to be valid  \n• Sessions are verified for token expiration or blocked clients  \n• Session are subscription based  \n• Two separate Channels: Market-data & Alerts  \n• Market-Data is high volume low latency perishable data with no guaranteed delivery  \n• Alerts channel is ordered (FIFO) guaranteed delivery to all active sessions  \n• Market Data channel data pushes based on subscription commands  \n• Alerts channel is single session created by default, but all sessions get the data\n\n**URLS**\n\n- Development URL is: [https://api.bloxcross-dev.com](https://api.bloxcross-dev.comWebsocket)\n    \n- Websocket Alerts Endpoint: wss://api.bloxcross-dev.com/subscribe\n    \n- Websocket market Data Endpoint: wss://api.bloxcross-dev.com/tickerplant\n    \n\n# **WEBSOCKETS**\n\n## **ALERTS**\n\nThe alerts arrive via push over the Alerts websocket connection. All messages have the same structure:\n\n1. A header with information about the Message\n    \n2. The Data for the message\n    \n\nHere is a Alert example in Java:\n\n```\n{\n  \"header\": {\n    \"msg_type\": \"ORDER_NEW\",\n    \"level\": \"ALERT\",\n    \"notes\": \"\"\n  },\n  \"data\": {\n    \"oid\": \"eb94cd38-ad12-417d-befe-2a62c3f2bfda\",\n    \"reserve_id\": 33370227094893060,\n    \"user_oid\": \"880062851073121\",\n    \"client_id\": \"3619f00d-32d4-4983-92f8-ebfd3a68898b\",\n    \"symbol\": \"ETH-USD\",\n    \"side\": \"SELL\",\n    \"amount\": 1,\n    \"quantity\": 0,\n    \"order_state\": \"NEW\",\n    \"order_action\": \"NEW\",\n    \"type\": \"MARKET_BY_AMOUNT\",\n    \"price\": 0,\n    \"time_in_force\": null,\n    \"valid_until\": null,\n    \"stop_type\": null,\n    \"data\": null,\n    \"created_on\": \"2023-07-21T20:14:16.046382948\",\n    \"portfolio_id\": \"5e85cab3-2745-43cb-9358-1fd2e81acd8c\",\n    \"executed_quantity\": 0,\n    \"fee_rate\": 100,\n    \"spread\": 100,\n    \"fee\": null,\n    \"held_qty\": 0.0005,\n    \"reserve_currency\": \"ETH\"\n  }\n}\n\n ```\n\nThe header contains two key pieces of data:\n\n1. **msg_type**: the type of message\n    \n2. **level**: the importance of the message\n    \n\nmsg_type can be one of:\n\n```\nORDER_NEW,\nORDER_CANCEL,\nORDER_REJECTED,\nORDER_UPDATE,\nORDER_ERROR,\nEXECUTION,\nTRACKING_EXECUTION,\nDEPOSIT_INITIATED,\nDEPOSIT,\nDEPOSIT_REVERSED,\nWITHDRAW_INITIATED,\nWITHDRAW,\nWITHDRAW_REVERSED,\nINFO,\nROBBIE,\nKYC,\nAML,\nDISPLAY_TO_USER\n\n ```\n\nlevel can be one of:\n\n```\nINFO,\nWARN,\nALERT\n\n ```\n\nHere is an example in Java to connect to Alerts Websocket:\n\n```\nimport org.java_websocket.client.WebSocketClient;\nimport org.java_websocket.drafts.Draft;\nimport org.java_websocket.handshake.ServerHandshake;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.security.KeyManagementException;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Map;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport static java.lang.System.exit;\npublic class TestClient\n        extends WebSocketClient {\n    private static Logger log = LoggerFactory.getLogger(TestClient.class);\n    private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);\n    public TestClient(\n            URI serverUri,\n            Draft draft\n    ) {\n        super(\n                serverUri,\n                draft\n        );\n    }\n    public TestClient(URI serverURI) {\n        super(serverURI);\n    }\n    public TestClient(\n            URI serverUri,\n            Map httpHeaders\n    ) {\n        super(\n                serverUri,\n                httpHeaders\n        );\n    }\n    public static void main(String[] args)\n            throws\n            URISyntaxException,\n            IOException,\n            NoSuchAlgorithmException,\n            KeyManagementException,\n            InterruptedException {\n        String host = \"api.bloxcross-dev.com\";;\n        log.info(\">>> Connecting to: [wss://\" + host + \"/subscribe]\");\n        TestClient c = new TestClient(new URI(\n                \"wss://\" + host + \"/subscribe\"));\n        c.connect();\n        c.setConnectionLostTimeout(30);\n        Thread.sleep(5000);\n        c.send(\"{\\\"token\\\": \\\"yJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJtepdlSdXN0NjhAZ21haWwuY29tIiwibGFzdF9sb2dpbiI6IntcInRpbWVcIjpcIjIwMjMtMDctMjFUMTM6MDc6NTQuMjY4MDI4XCIsXCJjaXR5XCI6XCJTYW4gTWFyY29zXCIsXCJyZWdpb25cIjpcIkNhbGlmb3JuaWFcIixcImNvdW50cnlcIjpcIlVuaXRlZCBTdGF0ZXNcIixcImxvY2FsZVwiOlwiQW1lcmljYS9Mb3NfQW5nZWxlc1wifSIsInJvbGVzIjpbXSwiaXNzIjoic2VjdXJpdHkiLCJzZXNzaW9uX2lkIjoiMDIyY2Q4ODUtYjA5MS00YWFhLWI4ZDgtMTkxZmE2NTM3ZjA4IiwiY2xpZW50X2lkIjoiMzYxOWYwMGQtMzJkNC00OTgzLTkyZjgtZWJmZDNhNjg4OThiIiwicmVxdWlyZWRfMmZhXzJwcm9jZWVkIjoiU01TIiwibmJmIjoxNjg5OTcwMDc0LCJkb21pY2lsZSI6IkNPIiwiY3VycmVuY3kiOiJNWE4iLCJhdXRoX2Nob2ljZSI6ImF1dGhfZGVjbGluZWQiLCJleHAiOjE2OTUxNTQwNzQsImxhbmciOiJwb3IiLCJpYXQiOjE2ODk5NzAwNzQsImVtYWlsIjoibXhfdGVzdDY4QGdtYWlsLmNvbSJ9.h4_7MLtNiiymQnANJf6RhReoFdj_HmZl3vW9gAc2SA\\\"}\");\n    }\n    @Override\n    public void onOpen(ServerHandshake handshakedata) {\n        log.info(\"opened connection: \" + handshakedata.getHttpStatusMessage());\n    }\n    @Override\n    public void onMessage(String message) {\n        log.info(\"received: \" + message);\n    }\n    @Override\n    public void onClose(\n            int code,\n            String reason,\n            boolean remote\n    ) {\n        // The close codes are documented in class org.java_websocket.framing.CloseFrame\n        log.info(\n                \"Connection closed by \" + (remote ? \"remote peer\" : \"us\") + \" Code: \" + code + \" Reason: \"\n                        + reason);\n        exit(-1);\n    }\n    @Override\n    public void onError(Exception ex) {\n        ex.printStackTrace();\n        // if the error is fatal then onClose will be called additionally\n        System.err.println(\"Error: \" + ex.getMessage());\n    }\n}\n\n ```\n\n## MARKET DATA\n\nThe Market Data Ticker Plant publishes real time market data via Websocket Push. Once you connect to the Ticker Plant, you must send a subscription request for subscribing tp market data as follows:\n\n```\n{\n  \"type\": \"subscribe\",\n  \"channels\": [\n    {\n      \"name\": \"inside_market\",\n      \"product_ids\": [\n        \"BTC-USD\"\n      ]\n    }\n  ]\n}\n\n ```\n\nHere is an example for connecting to Market Data Websocket in Java:\n\n```\nimport org.java_websocket.client.WebSocketClient;\nimport org.java_websocket.drafts.Draft;\nimport org.java_websocket.handshake.ServerHandshake;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.nio.ByteBuffer;\npublic class TestClient\n        extends WebSocketClient {\n    public TestClient(\n            URI serverUri,\n            Draft draft\n    ) {\n        super(\n                serverUri,\n                draft\n        );\n    }\n    public TestClient(URI serverURI) {\n        super(serverURI);\n    }\n    public static void main(String[] args)\n            throws\n            URISyntaxException,\n            InterruptedException {\n        System.out.println(\"...Starting Client\");\n        WebSocketClient client = new TestClient(new URI(\"wss://api.bloxcross-dev.com/tickerplant\"));\n        client.connect();\n        client.setConnectionLostTimeout(30);\n        Thread.sleep(5000);\n        client.send(\" {\\\"type\\\": \\\"subscribe\\\",\\\"channels\\\": [{\\\"name\\\": \\\"inside_market\\\",\\\"product_ids\\\": \"\n                            + \"[\\\"BTC-USD\\\"]}]}\");\n    }\n    @Override\n    public void onOpen(ServerHandshake handshakedata) {\n        System.out.println(\"new connection opened\");\n    }\n    @Override\n    public void onClose(\n            int code,\n            String reason,\n            boolean remote\n    ) {\n        System.out.println(\"closed with exit code \" + code + \" additional info: \" + reason);\n    }\n    @Override\n    public void onMessage(String message) {\n        System.out.println(\"received message: \" + message);\n    }\n    @Override\n    public void onMessage(ByteBuffer message) {\n        System.out.println(\"received ByteBuffer\");\n    }\n    @Override\n    public void onError(Exception ex) {\n        System.err.println(\"an error occurred:\" + ex);\n    }\n}\n\n ```\n\n# REST API","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"6819598","team":1785776,"collectionId":"b99fe274-e7be-4d65-92d1-9d451ea6603d","publishedId":"2s946bBZvX","public":true,"publicUrl":"https://docs.bloxcross-dev.com","privateUrl":"https://go.postman.co/documentation/6819598-b99fe274-e7be-4d65-92d1-9d451ea6603d","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.11.6","publishDate":"2023-07-11T13:31:26.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/2f35116547f87dd25a6656f53ff5cdac76d07b04f12a83867a08e139a4b5042a","favicon":"https://bloxcross-dev.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://docs.bloxcross-dev.com/view/metadata/2s946bBZvX"}