{"_id":"56ea13b0cf35bf0e00adb8df","parentDoc":null,"user":"54f5fae5b175300d00d44b2f","category":{"_id":"56e9fe9779708c0e002b6026","pages":["56e9fea046ea9b0e001ddda0","56e9fecacda7120e00b5b13c","56ea01757e21ac0e00131024","56ea0a0679708c0e002b6031","56ea0b117e21ac0e0013102f","56ea13b0cf35bf0e00adb8df","56eb33659b984b29002136a8","56eb341d9b984b29002136ae","56eb342f3d6fdb3200a72302"],"version":"55909cb433090f0d004d25d8","__v":9,"project":"558b53f749dc4f0d00517de0","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-17T00:47:19.023Z","from_sync":false,"order":9,"slug":"beta","title":"Wallet Management"},"githubsync":"","version":{"_id":"55909cb433090f0d004d25d8","project":"558b53f749dc4f0d00517de0","forked_from":"558b53f749dc4f0d00517de3","__v":8,"createdAt":"2015-06-29T01:17:40.214Z","releaseDate":"2015-06-29T01:17:40.214Z","categories":["55909cb433090f0d004d25d9","55909cb433090f0d004d25da","55909cb433090f0d004d25db","55909cb433090f0d004d25dc","56c72c00197f9f1700c811db","56c72df5b3625c0d00422c9e","56e1b646150ed52d0062c652","56e9fe9779708c0e002b6026","57312dc94245100e001743f4","57646a570742400e00c04701","5894c96f4d9c7e27002e42ba"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"project":"558b53f749dc4f0d00517de0","__v":45,"updates":["5a91b8c1c64e8e001ccf26c2"],"next":{"pages":[],"description":""},"createdAt":"2016-03-17T02:17:20.869Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[]},"settings":"","auth":"required","params":[{"_id":"58ddcfb9c788b80f0043a374","ref":"","in":"body","required":false,"desc":"Unique identifier for the user","default":"","type":"string","name":"name"},{"_id":"58ddcfb9c788b80f0043a373","ref":"","in":"body","required":false,"desc":"Callback url we will make HTTP postbacks to on wallet updates","default":"","type":"string","name":"callbackUrl"},{"_id":"58ddcfb9c788b80f0043a372","ref":"","in":"body","required":false,"desc":"The type of wallet you are creating","default":"DEFAULT","type":"string","name":"type"}],"url":"/wallets"},"isReference":false,"order":0,"body":"#Create a new user\n\n## Building the creation request\n\nWhen building your Creation request you'll need to use 2 out of these 4 fields:\n- `name` - Your unique identifier for this user.\n- `callbackUrl` - Optional callback when the user receives funds.\n- `notes` - Optional notes about the user\n- `type` - The type of user you are creating, DEFAULT or ENTERPRISE\n\n## Params\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"key\",\n    \"h-1\": \"type\",\n    \"h-2\": \"description\",\n    \"h-3\": \"required\",\n    \"0-0\": \"name\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Unique identifier for the user\",\n    \"1-0\": \"callbackUrl\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Callback for updates\",\n    \"2-0\": \"notes\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Notes about the user\",\n    \"0-3\": \"true\",\n    \"1-3\": \"false\",\n    \"2-3\": \"false\",\n    \"3-0\": \"type\",\n    \"3-1\": \"String\",\n    \"3-2\": \"The type of user you are creating, defaults to DEFAULT\",\n    \"3-3\": \"false\"\n  },\n  \"cols\": 4,\n  \"rows\": 4\n}\n[/block]\n## Code Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -XPOST 'https://api.sendwyre.com/v2/wallets' \\\\\\n\\t-H \\\"Content-Type: application/json\\\" \\\\\\n  -H \\\"X-Api-Key: {api-key}\\\" \\\\\\n  -H \\\"X-Api-Signature: {signature}\\\" \\\\\\n\\t-d '{\\\"type\\\":\\\"ENTERPRISE\\\",\\\"name\\\":\\\"{your-unique-identifier}\\\",\\\"callbackUrl\\\":\\\"https://your.website.io/callback\\\",\\\"notes\\\":\\\"Notes about the sub account\\\"}'\\n\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"import javax.crypto.Mac;\\nimport javax.crypto.spec.SecretKeySpec;\\nimport java.io.BufferedReader;\\nimport java.io.DataOutputStream;\\nimport java.io.InputStream;\\nimport java.io.InputStreamReader;\\nimport java.lang.Integer;\\nimport java.lang.String;\\nimport java.lang.StringBuffer;\\nimport java.net.HttpURLConnection;\\nimport java.net.URL;\\n\\npublic class Main {\\n\\tpublic static void main(String[] args) {\\n\\t\\tString accountId = \\\"k3f48j0rb2rp65c0sdog67vi43u80jas\\\";\\n\\t\\tString apiKey = \\\"fll36l3t35udalcqlh4ng6bm4qpbgher\\\";\\n\\t\\tString secretKey = \\\"tr3epinbk3maist0n3ijk18bm6dikrq6\\\";\\n\\n\\t\\tString url = \\\"https://api.sendwyre.com/v2/wallets\\\";\\n\\t\\tString method = \\\"POST\\\";\\n\\t\\tString data = \\\"\\\";\\n\\n\\t\\tString result = excuteWyereRequest(url, \\\"\\\", method, apiKey, secretKey);\\n\\t\\tSystem.out.println(result);\\n\\n\\t\\tdata = \\\"{\\\" +\\n        \\\"  \\\\\\\"type\\\\\\\":\\\\\\\"ENTERPRISE\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"name\\\\\\\":\\\\\\\"{your-unique-identifier}\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"callbackUrl\\\\\\\":\\\\\\\"https://your.website.io/callback\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"notes\\\\\\\":\\\\\\\"Notes about the user\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"verificationData\\\\\\\": {\\\" +\\n        \\\"      \\\\\\\"firstName\\\\\\\":\\\\\\\"{users-first-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"middleName\\\\\\\":\\\\\\\"{users-middle-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"lastName\\\\\\\":\\\\\\\"{users-last-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"ssn\\\\\\\":\\\\\\\"0000\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"passport\\\\\\\":\\\\\\\"123456\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"birthDay\\\\\\\":\\\\\\\"1\\\\\\\",\\\" +\\n        \\\"\\t     \\\\\\\"birthMonth\\\\\\\":\\\\\\\"1\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"birthYear\\\\\\\":\\\\\\\"1970\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"phoneNumber\\\\\\\":\\\\\\\"+15555555555\\\\\\\",\\\" +\\n        \\\"\\t\\t   \\\\\\\"address\\\\\\\": {\\\" +\\n        \\\"          \\\\\\\"street1\\\\\\\":\\\\\\\"1 Market Street\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"street2\\\\\\\":\\\\\\\"Suit 420\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"city\\\\\\\":\\\\\\\"San Francisco\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"state\\\\\\\":\\\\\\\"CA\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"postalCode\\\\\\\":\\\\\\\"94105\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"country\\\\\\\":\\\\\\\"US\\\\\\\"\\\" +\\n        \\\"      }\\\" +\\n        \\\"  }\\\" +\\n\\t\\t\\t\\t\\\"}\\\";\\n\\t\\tresult = excuteWyreRequest(url, data, method, apiKey, secretKey);\\n\\n\\t\\tSystem.out.println(result);\\n\\t}\\n\\n\\tpublic static String excuteWyreRequest(String targetURL, String requestBody, String method, String apiKey, String secretKey) {\\n\\t\\tURL url;\\n\\t\\tHttpURLConnection connection = null;\\n\\t\\ttry {\\n\\n\\t\\t\\ttargetURL += ((targetURL.indexOf(\\\"?\\\")>0)?\\\"&\\\":\\\"?\\\") + \\\"timestamp=\\\" + System.currentTimeMillis();\\n\\n\\t\\t\\t//Create connection\\n\\t\\t\\turl = new URL(targetURL);\\n\\t\\t\\tconnection = (HttpURLConnection)url.openConnection();\\n\\t\\t\\tconnection.setRequestMethod(method);\\n\\t\\t\\tSystem.out.println(connection.getRequestMethod());\\n\\n\\t\\t\\tconnection.setRequestProperty(\\\"Content-Type\\\", \\\"application/json\\\");\\n\\t\\t\\tconnection.setRequestProperty(\\\"Content-Length\\\", Integer.toString(requestBody.getBytes().length));\\n\\n\\t\\t\\t//Specify API v2\\n\\t\\t\\tconnection.setRequestProperty(\\\"X-Api-Version\\\",\\\"2\\\");\\n\\n\\t\\t\\t// Provide API key and signature\\n\\t\\t\\tconnection.setRequestProperty(\\\"X-Api-Key\\\", apiKey);\\n\\t\\t\\tconnection.setRequestProperty(\\\"X-Api-Signature\\\",computeSignature(secretKey,targetURL,requestBody));\\n\\n\\t\\t\\t//Send request\\n\\t\\t\\tif(method.equals(\\\"POST\\\")) {\\n\\t\\t\\t\\tconnection.setDoOutput(true);\\n\\t\\t\\t\\tconnection.setRequestMethod(method);\\n\\n\\t\\t\\t\\tDataOutputStream wr = new DataOutputStream(\\n\\t\\t\\t\\t\\t\\tconnection.getOutputStream());\\n\\n\\t\\t\\t\\twr.writeBytes(requestBody);\\n\\t\\t\\t\\twr.flush();\\n\\t\\t\\t\\twr.close();\\n\\t\\t\\t}\\n\\n\\t\\t\\t//Get Response\\n\\t\\t\\tInputStream is = connection.getInputStream();\\n\\t\\t\\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\\n\\t\\t\\tString line;\\n\\t\\t\\tStringBuffer response = new StringBuffer();\\n\\t\\t\\twhile((line = rd.readLine()) != null) {\\n\\t\\t\\t\\tresponse.append(line);\\n\\t\\t\\t\\tresponse.append('\\\\r');\\n\\t\\t\\t}\\n\\t\\t\\trd.close();\\n\\t\\t\\treturn response.toString();\\n\\n\\t\\t} catch (Exception e) {\\n\\n\\t\\t\\te.printStackTrace();\\n\\t\\t\\treturn null;\\n\\n\\t\\t} finally {\\n\\n\\t\\t\\tif(connection != null) {\\n\\t\\t\\t\\tconnection.disconnect();\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n\\n\\tpublic static String computeSignature(String secretKey, String url, String reqData) {\\n\\n\\t\\tString data = url + reqData;\\n\\n\\t\\tSystem.out.println(data);\\n\\n\\t\\ttry {\\n\\t\\t\\tMac sha256Hmac = Mac.getInstance(\\\"HmacSHA256\\\");\\n\\t\\t\\tSecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), \\\"HmacSHA256\\\");\\n\\t\\t\\tsha256Hmac.init(key);\\n\\n\\t\\t\\tbyte[] macData = sha256Hmac.doFinal(data.getBytes());\\n\\n\\t\\t\\tString result = \\\"\\\";\\n\\t\\t\\tfor (final byte element : macData){\\n\\t\\t\\t\\tresult += Integer.toString((element & 0xff) + 0x100, 16).substring(1);\\n\\t\\t\\t}\\n\\t\\t\\treturn result;\\n\\n\\t\\t} catch (Exception e) {\\n\\t\\t\\te.printStackTrace();\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t}\\n\\t}\\n}\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"#dependencies:\\n#python3\\n#pip3 install requests\\n\\nimport json\\nimport hmac\\nimport time\\nfrom requests import request\\n\\nclass MassPay_API(object):\\n    def __init__(self, account_id, api_version, api_key, api_secret):\\n        self.account_id = account_id\\n        self.api_url = 'https://api.sendwyre.com/{}'.format(api_version)\\n        self.api_version = api_version\\n        self.api_key = api_key\\n        self.api_secret = api_secret\\n\\n    #authentication decorator. May raise ValueError if no json content is returned\\n    def authenticate_request(func):\\n        def wrap(self, *args, **kwargs):\\n            url, method, body = func(self, *args, **kwargs)\\n            params = {}\\n            timestamp = int(time.time() * 1000)\\n            url += '?timestamp={}'.format(timestamp)\\n            bodyJson = json.dumps(body) if body != '' else ''\\n            headers = {}\\n            headers['Content-Type'] = 'application/json'\\n            headers['X-Api-Version'] = self.api_version\\n            headers['X-Api-Key'] = self.api_key\\n            headers['X-Api-Signature'] = hmac.new(self.api_secret.encode('utf-8'), (url + bodyJson).encode('utf-8'), 'SHA256').hexdigest()\\n            print(headers['X-Api-Signature'])\\n            resp = request(method=method, url=url, params=params, data=(json.dumps(body) if body != '' else None), json=None, headers=headers)\\n            if resp.text is not None: #Wyre will always try to give an err body\\n                return resp.status_code, resp.json()\\n            return 404, {}\\n        return wrap\\n\\n    :::at:::authenticate_request\\n    def create_user(self, name, callbackUrl, notes, verificationData):\\n        url = self.api_url + '/wallets'\\n        method = 'POST'\\n        body = {'name':name,\\n                'verificationData':verificationData,\\n                'type':'ENTERPRISE'}\\n        if callbackUrl:\\n            body[\\\"callbackUrl\\\"] = callbackUrl\\n        if notes:\\n            body['notes'] = notes\\n        return url, method, body \\n\\n#USAGE Example\\naccount_id = \\\"YOUR_ACCOUNT_ID_HERE\\\" #optional\\napi_key = \\\"YOUR_API_KEY_HERE\\\"\\nsecret_key = \\\"YOUR_SECRET_KEY_HERE\\\"\\napi_version = \\\"2\\\"\\n\\n#create Wyre MassPay API object\\nWyre = MassPay_API(account_id, api_version, api_key, secret_key)\\n\\n#create user and print result\\nhttp_code, result = Wyre.create_user(\\n                                \\\"{your-unique-identifier}\\\", \\n                                \\\"https://your.website.io/callback\\\", \\n                                None, #notes\\n                                {\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"firstName\\\": \\\"{users-first-name}\\\",\\n                     \\t\\t\\t\\t\\t\\t\\t\\\"middleName\\\": \\\"{users-middle-name}\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"lastName\\\": \\\"{users-last-name}\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"ssn\\\": \\\"0000\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"passport\\\": \\\"123456\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"birthDay\\\": \\\"1\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"birthMonth\\\": \\\"1\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"birthYear\\\": \\\"1970\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"phoneNumber\\\": \\\"+15555555555\\\",\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"address\\\": {\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"street1\\\":\\\"1 Market Street\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"street2\\\":\\\"Suite 420\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"city\\\":\\\"San Francisco\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"state\\\":\\\"CA\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"postalCode\\\":\\\"94105\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"country\\\":\\\"US\\\"\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t})\\nprint(result)\\nusers_srn = result['srn'] #grab our srn identifier for the user\",\n      \"language\": \"python\",\n      \"name\": null\n    },\n    {\n      \"code\": \"using System;\\nusing System.IO;\\nusing System.Net;\\nusing System.Security.Cryptography;\\nusing System.Text;\\n\\nnamespace test\\n{\\n\\tclass MainClass\\n\\t{\\n\\t\\tpublic static void Main(string[] args)\\n\\t\\t{\\n\\t\\t\\tWyreApi wyreApi = new WyreApi();\\n\\n\\t\\t\\tstring userData = \\\"{\\\" +\\n        \\\"  \\\\\\\"type\\\\\\\":\\\\\\\"ENTERPRISE\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"name\\\\\\\":\\\\\\\"{your-unique-identifier}\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"callbackUrl\\\\\\\":\\\\\\\"https://your.website.io/callback\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"notes\\\\\\\":\\\\\\\"Notes about the user\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"verificationData\\\\\\\": {\\\" +\\n        \\\"      \\\\\\\"firstName\\\\\\\":\\\\\\\"{users-first-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"middleName\\\\\\\":\\\\\\\"{users-middle-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"lastName\\\\\\\":\\\\\\\"{users-last-name}\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"ssn\\\\\\\":\\\\\\\"0000\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"passport\\\\\\\":\\\\\\\"123456\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"birthDay\\\\\\\":\\\\\\\"1\\\\\\\",\\\" +\\n        \\\"\\t     \\\\\\\"birthMonth\\\\\\\":\\\\\\\"1\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"birthYear\\\\\\\":\\\\\\\"1970\\\\\\\",\\\" +\\n        \\\"      \\\\\\\"phoneNumber\\\\\\\":\\\\\\\"+15555555555\\\\\\\",\\\" +\\n        \\\"\\t\\t   \\\\\\\"address\\\\\\\": {\\\" +\\n        \\\"          \\\\\\\"street1\\\\\\\":\\\\\\\"1 Market Street\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"street2\\\\\\\":\\\\\\\"Suit 420\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"city\\\\\\\":\\\\\\\"San Francisco\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"state\\\\\\\":\\\\\\\"CA\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"postalCode\\\\\\\":\\\\\\\"94105\\\\\\\",\\\" +\\n        \\\"          \\\\\\\"country\\\\\\\":\\\\\\\"US\\\\\\\"\\\" +\\n        \\\"      }\\\" +\\n        \\\"  }\\\" +\\n\\t\\t\\t\\t\\\"}\\\";\\n\\t\\t\\tstring new_user = wyreApi.createUser(userData);\\n\\t\\t\\tConsole.WriteLine(new_user);\\n\\t\\t}\\n\\t}\\n\\n\\tpublic class WyreApi {\\n\\t\\tprivate const string domain = \\\"https://api.sendwyre.com\\\";\\n\\t\\tprivate const string apiKey = \\\"xxxxxx\\\";\\n\\t\\tprivate const string secKey = \\\"xxxxxx\\\";\\n\\n\\t\\tpublic string createUser(string jsonString)\\n\\t\\t{\\n\\t\\t\\treturn MakePostReq(\\\"/wallets\\\", jsonString);\\n\\t\\t}\\n\\n\\t\\tprivate string MakePostReq(string apiRoute, string jsonData)\\n\\t\\t{\\n\\t\\t\\tWebRequest req = AssembleWebRequest(apiRoute, jsonData);\\n\\t\\t\\treq.Method = \\\"POST\\\";\\n\\t\\t\\tWriteJsonToRequest(req, jsonData);\\n\\n\\t\\t\\tWebResponse response = req.GetResponse();\\n\\t\\t\\tstring responseString = ParseWebResponse(response);\\n\\t\\t\\treturn responseString;\\n\\t\\t}\\n\\n\\t\\tprivate WebRequest AssembleWebRequest(string apiRoute, string jsonData = \\\"\\\")\\n\\t\\t{\\n\\t\\t\\tstring url = domain + apiRoute + (apiRoute.Contains(\\\"?\\\")?\\\"&\\\":\\\"?\\\") + \\\"timestamp=\\\"+DateTime.Now.Ticks; \\n\\t\\t\\tWebRequest request = WebRequest.Create(url);\\n\\t\\t\\tstring authSig = CalcAuthSigHash(secKey, url + jsonData);\\n\\n\\t\\t\\trequest.ContentType = \\\"application/json\\\";\\n\\t\\t\\trequest.Headers[\\\"X-Api-Key\\\"] = apiKey;\\n\\t\\t\\trequest.Headers[\\\"X-Api-Signature\\\"] = authSig;\\n\\t\\t\\trequest.Headers[\\\"X-Api-Version\\\"] = \\\"2\\\";\\n\\t\\t\\treturn request;\\n\\t\\t}\\n\\n\\t\\tprivate void WriteJsonToRequest(WebRequest req, string jsonData)\\n\\t\\t{\\n\\t\\t\\tvar streamWriter = new StreamWriter(req.GetRequestStream ());\\n\\t\\t\\tstreamWriter.Write(jsonData);\\n\\t\\t\\tstreamWriter.Close();\\n\\t\\t}\\n\\n\\t\\tprivate byte[] GetBytes(string str)\\n\\t\\t{\\n\\t\\t\\treturn Encoding.UTF8.GetBytes(str);\\n\\t\\t}\\n\\n\\t\\tprivate string GetString(byte[] bytes)\\n\\t\\t{\\n\\t\\t\\treturn BitConverter.ToString(bytes);\\n\\t\\t}\\n\\n\\t\\tprivate string CalcAuthSigHash(string key, string value)\\n\\t\\t{\\n\\t\\t\\tHMACSHA256 hmac = new HMACSHA256(GetBytes(key));\\n\\t\\t\\tstring hash = GetString(hmac.ComputeHash(GetBytes(value)));\\n\\t\\t\\thash = hash.Replace(\\\"-\\\", \\\"\\\");\\n\\t\\t\\treturn hash;\\n\\t\\t}\\n\\n\\t\\tprivate string ParseWebResponse(WebResponse response)\\n\\t\\t{\\n\\t\\t\\tStreamReader streamReader = new StreamReader(response.GetResponseStream());\\n\\t\\t\\tstring result = streamReader.ReadToEnd();\\n\\t\\t\\tstreamReader.Close();\\n\\t\\t\\treturn result;\\n\\t\\t}\\n\\t}\\n}\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"<?php\\n    function make_authenticated_request($endpoint, $method, $body) {\\n        $url = 'https://api.sendwyre.com';\\n        $api_key = \\\"bh405n7stsuo5ut30iftrsl71b4iqjnv\\\";\\n        $secret_key = \\\"a19cvrchgja82urvn47kirrlrrb7stgg\\\";\\n\\n        $timestamp = floor(microtime(true)*1000);\\n        $request_url = $url . $endpoint;\\n\\n        if(strpos($request_url,\\\"?\\\"))\\n            $request_url .= '&timestamp=' . $timestamp;\\n        else\\n            $request_url .= '?timestamp=' . $timestamp;\\n\\n        if(!empty($body))\\n            $body = json_encode($body, JSON_FORCE_OBJECT);\\n        else\\n            $body = '';\\n\\n        $headers = array(\\n            \\\"Content-Type: application/json\\\",\\n            \\\"X-Api-Key: \\\". $api_key,\\n            \\\"X-Api-Signature: \\\". calc_auth_sig_hash($secret_key, $request_url . $body),\\n            \\\"X-Api-Version: 2\\\"\\n        );\\n        $curl = curl_init();\\n\\n        if($method==\\\"POST\\\"){\\n          $options = array(\\n            CURLOPT_URL             => $request_url,\\n            CURLOPT_POST            =>  true,\\n            CURLOPT_POSTFIELDS      => $body,\\n            CURLOPT_RETURNTRANSFER  => true);\\n        }else {\\n          $options = array(\\n            CURLOPT_URL             => $request_url,\\n            CURLOPT_RETURNTRANSFER  => true);\\n        }\\n        curl_setopt_array($curl, $options);\\n        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\\n        $result = curl_exec($curl);\\n        curl_close($curl);\\n        var_dump($result);\\n        return json_decode($result, true);\\n    }\\n\\n    function calc_auth_sig_hash($seckey, $val) {\\n        $hash = hash_hmac('sha256', $val, $seckey);\\n        return $hash;\\n    }\\n\\n\\t\\t$userData = array(\\n      \\\"type\\\"=>\\\"ENTERPRISE\\\",\\n      \\\"name\\\"=>\\\"{your-unique-identifier}\\\",\\n      \\\"callbackUrl\\\"=>\\\"https://your.website.io/callback\\\",\\n      \\\"notes\\\"=> \\\"Notes about the user\\\",\\n      \\\"verificationData\\\"=> array(\\n        \\t\\\"firstName\\\"=> \\\"{users-first-name}\\\",\\n          \\\"middleName\\\"=> \\\"{users-middle-name}\\\",\\n          \\\"lastName\\\"=> \\\"{users-last-name}\\\",\\n          \\\"ssn\\\"=> \\\"0000\\\",\\n          \\\"passport\\\"=> \\\"12345\\\",\\n          \\\"birthDay\\\"=> \\\"1\\\",\\n          \\\"birthMonth\\\"=> \\\"1\\\",\\n          \\\"birthYear\\\"=> \\\"1970\\\",\\n          \\\"phoneNumber\\\"=> \\\"+15555555555\\\",\\n          \\\"address\\\"=> array(\\n            \\\"street1\\\":\\\"1 Market Street\\\",\\n            \\\"street2\\\":\\\"Suite 420\\\",\\n            \\\"city\\\":\\\"San Francisco\\\",\\n            \\\"state\\\":\\\"CA\\\",\\n            \\\"postalCode\\\":\\\"94105\\\",\\n            \\\"country\\\":\\\"US\\\"\\n          )\\n        )\\n      );\\n\\t\\techo make_authenticated_request(\\\"/wallets\\\", \\\"POST\\\", $userData);\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"#!/bin/bash\\napiKey='P8Lc7vzwR6dSpWY'\\nsecret='Atk0MZ1xSOlW250'\\n\\ntimestamp=`date +%s`\\ntimestamp+=\\\"000\\\"\\nurl='https://api.sendwyre.com/v2/wallets?timestamp='\\nurl+=$timestamp\\n\\nbody='{\\\"type\\\":\\\"ENTERPRISE\\\",\\\"name\\\":\\\"{your-unique-identifier3}\\\",\\\"callbackUrl\\\":\\\"https://your.website.io/callback\\\",\\\"notes\\\":\\\"Notes about the sub account\\\",\\\"verificationData\\\":{\\\"firstName\\\":\\\"{users-first-name}\\\",\\\"middleName\\\":\\\"{users-middle-name}\\\",\\\"lastName\\\":\\\"{users-last-name}\\\",\\\"ssn\\\":\\\"0000\\\",\\\"passport\\\":\\\"123456\\\",\\\"birthDay\\\":\\\"1\\\",\\\"birthMonth\\\":\\\"1\\\",\\\"birthYear\\\":\\\"1970\\\",\\\"phoneNumber\\\":\\\"+15555555555\\\",\\\"address\\\":{\\\"street1\\\":\\\"1 Market Street\\\",\\\"street2\\\":\\\"Suite 420\\\",\\\"city\\\":\\\"San Francisco\\\",\\\"state\\\":\\\"CA\\\",\\\"postalCode\\\":\\\"94105\\\",\\\"country\\\":\\\"US\\\"}}}'\\n\\ndata=$url\\ndata+=$body\\nsignature=`echo -n $data | openssl dgst -sha256 -hex -hmac $secret`\\n\\necho $apiKey\\necho $signature\\necho $url\\n\\ncurl -v -XPOST $url \\\\\\n\\t-H \\\"Content-Type: application/json\\\" \\\\\\n  -H \\\"X-Api-Key: $apiKey\\\" \\\\\\n  -H \\\"X-Api-Signature: $signature\\\" \\\\\\n\\t-H \\\"X-Api-Version: 2\\\" \\\\\\n\\t-d \\\"$body\\\"\\n\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n## Response\n\nWhen a new user is created you will receive the following:\n- `name` - Your identifier\n- `id` - Wyre's identifier\n- `depositAddresses` - Digital currency deposit addresses for the user\n- `totalBalances` - Total balance for the user\n- `availableBalances` - Funds available to the user\n- `pusherChannel` - Pusher update channel\n- `srn` - Wyre Reference Name identifier\n- `balances` - Balances for the user\n- `callbackUrl` - Your callback url\n- `notes` - Your note for the user\n- `verificationData` - KYC information for the user\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\" : \\\"{your-unique-identifier}\\\",\\n  \\\"id\\\" : \\\"AYBNA3lBiWAM4l3\\\",\\n  \\\"depositAddresses\\\" : {\\n    \\\"BTC\\\" : \\\"2ShL7kzSNNxedit6hC2fjSQhVcAucTeS1m7\\\"\\n  },\\n  \\\"totalBalances\\\" : {\\n    \\\"BTC\\\" : 0\\n  },\\n  \\\"availableBalances\\\" : {\\n    \\\"BTC\\\" : 0\\n  },\\n  \\\"srn\\\" : \\\"wallet:AYBNA3lBiWAM4l3\\\",\\n  \\\"balances\\\" : {\\n    \\\"BTC\\\" : 0\\n  },\\n  \\\"callbackUrl\\\" : \\\"https://your.website.io/callback\\\",\\n  \\\"notes\\\" : \\\"Notes about the user\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Full Response Object\"\n    }\n  ]\n}\n[/block]","excerpt":"create child wallet","slug":"users","type":"endpoint","title":"Create User"}

postCreate User

create child wallet

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

name:
string
Unique identifier for the user
callbackUrl:
string
Callback url we will make HTTP postbacks to on wallet updates
type:
stringDEFAULT
The type of wallet you are creating

Documentation

#Create a new user ## Building the creation request When building your Creation request you'll need to use 2 out of these 4 fields: - `name` - Your unique identifier for this user. - `callbackUrl` - Optional callback when the user receives funds. - `notes` - Optional notes about the user - `type` - The type of user you are creating, DEFAULT or ENTERPRISE ## Params [block:parameters] { "data": { "h-0": "key", "h-1": "type", "h-2": "description", "h-3": "required", "0-0": "name", "0-1": "String", "0-2": "Unique identifier for the user", "1-0": "callbackUrl", "1-1": "String", "1-2": "Callback for updates", "2-0": "notes", "2-1": "String", "2-2": "Notes about the user", "0-3": "true", "1-3": "false", "2-3": "false", "3-0": "type", "3-1": "String", "3-2": "The type of user you are creating, defaults to DEFAULT", "3-3": "false" }, "cols": 4, "rows": 4 } [/block] ## Code Examples [block:code] { "codes": [ { "code": "curl -v -XPOST 'https://api.sendwyre.com/v2/wallets' \\\n\t-H \"Content-Type: application/json\" \\\n -H \"X-Api-Key: {api-key}\" \\\n -H \"X-Api-Signature: {signature}\" \\\n\t-d '{\"type\":\"ENTERPRISE\",\"name\":\"{your-unique-identifier}\",\"callbackUrl\":\"https://your.website.io/callback\",\"notes\":\"Notes about the sub account\"}'\n", "language": "curl" }, { "code": "import javax.crypto.Mac;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.io.BufferedReader;\nimport java.io.DataOutputStream;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.lang.Integer;\nimport java.lang.String;\nimport java.lang.StringBuffer;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tString accountId = \"k3f48j0rb2rp65c0sdog67vi43u80jas\";\n\t\tString apiKey = \"fll36l3t35udalcqlh4ng6bm4qpbgher\";\n\t\tString secretKey = \"tr3epinbk3maist0n3ijk18bm6dikrq6\";\n\n\t\tString url = \"https://api.sendwyre.com/v2/wallets\";\n\t\tString method = \"POST\";\n\t\tString data = \"\";\n\n\t\tString result = excuteWyereRequest(url, \"\", method, apiKey, secretKey);\n\t\tSystem.out.println(result);\n\n\t\tdata = \"{\" +\n \" \\\"type\\\":\\\"ENTERPRISE\\\",\" +\n\t\t\t\t\" \\\"name\\\":\\\"{your-unique-identifier}\\\",\" +\n\t\t\t\t\" \\\"callbackUrl\\\":\\\"https://your.website.io/callback\\\",\" +\n\t\t\t\t\" \\\"notes\\\":\\\"Notes about the user\\\",\" +\n\t\t\t\t\" \\\"verificationData\\\": {\" +\n \" \\\"firstName\\\":\\\"{users-first-name}\\\",\" +\n \" \\\"middleName\\\":\\\"{users-middle-name}\\\",\" +\n \" \\\"lastName\\\":\\\"{users-last-name}\\\",\" +\n \" \\\"ssn\\\":\\\"0000\\\",\" +\n \" \\\"passport\\\":\\\"123456\\\",\" +\n \" \\\"birthDay\\\":\\\"1\\\",\" +\n \"\t \\\"birthMonth\\\":\\\"1\\\",\" +\n \" \\\"birthYear\\\":\\\"1970\\\",\" +\n \" \\\"phoneNumber\\\":\\\"+15555555555\\\",\" +\n \"\t\t \\\"address\\\": {\" +\n \" \\\"street1\\\":\\\"1 Market Street\\\",\" +\n \" \\\"street2\\\":\\\"Suit 420\\\",\" +\n \" \\\"city\\\":\\\"San Francisco\\\",\" +\n \" \\\"state\\\":\\\"CA\\\",\" +\n \" \\\"postalCode\\\":\\\"94105\\\",\" +\n \" \\\"country\\\":\\\"US\\\"\" +\n \" }\" +\n \" }\" +\n\t\t\t\t\"}\";\n\t\tresult = excuteWyreRequest(url, data, method, apiKey, secretKey);\n\n\t\tSystem.out.println(result);\n\t}\n\n\tpublic static String excuteWyreRequest(String targetURL, String requestBody, String method, String apiKey, String secretKey) {\n\t\tURL url;\n\t\tHttpURLConnection connection = null;\n\t\ttry {\n\n\t\t\ttargetURL += ((targetURL.indexOf(\"?\")>0)?\"&\":\"?\") + \"timestamp=\" + System.currentTimeMillis();\n\n\t\t\t//Create connection\n\t\t\turl = new URL(targetURL);\n\t\t\tconnection = (HttpURLConnection)url.openConnection();\n\t\t\tconnection.setRequestMethod(method);\n\t\t\tSystem.out.println(connection.getRequestMethod());\n\n\t\t\tconnection.setRequestProperty(\"Content-Type\", \"application/json\");\n\t\t\tconnection.setRequestProperty(\"Content-Length\", Integer.toString(requestBody.getBytes().length));\n\n\t\t\t//Specify API v2\n\t\t\tconnection.setRequestProperty(\"X-Api-Version\",\"2\");\n\n\t\t\t// Provide API key and signature\n\t\t\tconnection.setRequestProperty(\"X-Api-Key\", apiKey);\n\t\t\tconnection.setRequestProperty(\"X-Api-Signature\",computeSignature(secretKey,targetURL,requestBody));\n\n\t\t\t//Send request\n\t\t\tif(method.equals(\"POST\")) {\n\t\t\t\tconnection.setDoOutput(true);\n\t\t\t\tconnection.setRequestMethod(method);\n\n\t\t\t\tDataOutputStream wr = new DataOutputStream(\n\t\t\t\t\t\tconnection.getOutputStream());\n\n\t\t\t\twr.writeBytes(requestBody);\n\t\t\t\twr.flush();\n\t\t\t\twr.close();\n\t\t\t}\n\n\t\t\t//Get Response\n\t\t\tInputStream is = connection.getInputStream();\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\t\t\tString line;\n\t\t\tStringBuffer response = new StringBuffer();\n\t\t\twhile((line = rd.readLine()) != null) {\n\t\t\t\tresponse.append(line);\n\t\t\t\tresponse.append('\\r');\n\t\t\t}\n\t\t\trd.close();\n\t\t\treturn response.toString();\n\n\t\t} catch (Exception e) {\n\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\n\t\t} finally {\n\n\t\t\tif(connection != null) {\n\t\t\t\tconnection.disconnect();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static String computeSignature(String secretKey, String url, String reqData) {\n\n\t\tString data = url + reqData;\n\n\t\tSystem.out.println(data);\n\n\t\ttry {\n\t\t\tMac sha256Hmac = Mac.getInstance(\"HmacSHA256\");\n\t\t\tSecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), \"HmacSHA256\");\n\t\t\tsha256Hmac.init(key);\n\n\t\t\tbyte[] macData = sha256Hmac.doFinal(data.getBytes());\n\n\t\t\tString result = \"\";\n\t\t\tfor (final byte element : macData){\n\t\t\t\tresult += Integer.toString((element & 0xff) + 0x100, 16).substring(1);\n\t\t\t}\n\t\t\treturn result;\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn \"\";\n\t\t}\n\t}\n}", "language": "java" }, { "code": "#dependencies:\n#python3\n#pip3 install requests\n\nimport json\nimport hmac\nimport time\nfrom requests import request\n\nclass MassPay_API(object):\n def __init__(self, account_id, api_version, api_key, api_secret):\n self.account_id = account_id\n self.api_url = 'https://api.sendwyre.com/{}'.format(api_version)\n self.api_version = api_version\n self.api_key = api_key\n self.api_secret = api_secret\n\n #authentication decorator. May raise ValueError if no json content is returned\n def authenticate_request(func):\n def wrap(self, *args, **kwargs):\n url, method, body = func(self, *args, **kwargs)\n params = {}\n timestamp = int(time.time() * 1000)\n url += '?timestamp={}'.format(timestamp)\n bodyJson = json.dumps(body) if body != '' else ''\n headers = {}\n headers['Content-Type'] = 'application/json'\n headers['X-Api-Version'] = self.api_version\n headers['X-Api-Key'] = self.api_key\n headers['X-Api-Signature'] = hmac.new(self.api_secret.encode('utf-8'), (url + bodyJson).encode('utf-8'), 'SHA256').hexdigest()\n print(headers['X-Api-Signature'])\n resp = request(method=method, url=url, params=params, data=(json.dumps(body) if body != '' else None), json=None, headers=headers)\n if resp.text is not None: #Wyre will always try to give an err body\n return resp.status_code, resp.json()\n return 404, {}\n return wrap\n\n @authenticate_request\n def create_user(self, name, callbackUrl, notes, verificationData):\n url = self.api_url + '/wallets'\n method = 'POST'\n body = {'name':name,\n 'verificationData':verificationData,\n 'type':'ENTERPRISE'}\n if callbackUrl:\n body[\"callbackUrl\"] = callbackUrl\n if notes:\n body['notes'] = notes\n return url, method, body \n\n#USAGE Example\naccount_id = \"YOUR_ACCOUNT_ID_HERE\" #optional\napi_key = \"YOUR_API_KEY_HERE\"\nsecret_key = \"YOUR_SECRET_KEY_HERE\"\napi_version = \"2\"\n\n#create Wyre MassPay API object\nWyre = MassPay_API(account_id, api_version, api_key, secret_key)\n\n#create user and print result\nhttp_code, result = Wyre.create_user(\n \"{your-unique-identifier}\", \n \"https://your.website.io/callback\", \n None, #notes\n {\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"firstName\": \"{users-first-name}\",\n \t\t\t\t\t\t\t\"middleName\": \"{users-middle-name}\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"lastName\": \"{users-last-name}\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"ssn\": \"0000\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"passport\": \"123456\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"birthDay\": \"1\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"birthMonth\": \"1\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"birthYear\": \"1970\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"phoneNumber\": \"+15555555555\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"address\": {\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"street1\":\"1 Market Street\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"street2\":\"Suite 420\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"city\":\"San Francisco\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"state\":\"CA\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"postalCode\":\"94105\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"country\":\"US\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t})\nprint(result)\nusers_srn = result['srn'] #grab our srn identifier for the user", "language": "python", "name": null }, { "code": "using System;\nusing System.IO;\nusing System.Net;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace test\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tWyreApi wyreApi = new WyreApi();\n\n\t\t\tstring userData = \"{\" +\n \" \\\"type\\\":\\\"ENTERPRISE\\\",\" +\n\t\t\t\t\" \\\"name\\\":\\\"{your-unique-identifier}\\\",\" +\n\t\t\t\t\" \\\"callbackUrl\\\":\\\"https://your.website.io/callback\\\",\" +\n\t\t\t\t\" \\\"notes\\\":\\\"Notes about the user\\\",\" +\n\t\t\t\t\" \\\"verificationData\\\": {\" +\n \" \\\"firstName\\\":\\\"{users-first-name}\\\",\" +\n \" \\\"middleName\\\":\\\"{users-middle-name}\\\",\" +\n \" \\\"lastName\\\":\\\"{users-last-name}\\\",\" +\n \" \\\"ssn\\\":\\\"0000\\\",\" +\n \" \\\"passport\\\":\\\"123456\\\",\" +\n \" \\\"birthDay\\\":\\\"1\\\",\" +\n \"\t \\\"birthMonth\\\":\\\"1\\\",\" +\n \" \\\"birthYear\\\":\\\"1970\\\",\" +\n \" \\\"phoneNumber\\\":\\\"+15555555555\\\",\" +\n \"\t\t \\\"address\\\": {\" +\n \" \\\"street1\\\":\\\"1 Market Street\\\",\" +\n \" \\\"street2\\\":\\\"Suit 420\\\",\" +\n \" \\\"city\\\":\\\"San Francisco\\\",\" +\n \" \\\"state\\\":\\\"CA\\\",\" +\n \" \\\"postalCode\\\":\\\"94105\\\",\" +\n \" \\\"country\\\":\\\"US\\\"\" +\n \" }\" +\n \" }\" +\n\t\t\t\t\"}\";\n\t\t\tstring new_user = wyreApi.createUser(userData);\n\t\t\tConsole.WriteLine(new_user);\n\t\t}\n\t}\n\n\tpublic class WyreApi {\n\t\tprivate const string domain = \"https://api.sendwyre.com\";\n\t\tprivate const string apiKey = \"xxxxxx\";\n\t\tprivate const string secKey = \"xxxxxx\";\n\n\t\tpublic string createUser(string jsonString)\n\t\t{\n\t\t\treturn MakePostReq(\"/wallets\", jsonString);\n\t\t}\n\n\t\tprivate string MakePostReq(string apiRoute, string jsonData)\n\t\t{\n\t\t\tWebRequest req = AssembleWebRequest(apiRoute, jsonData);\n\t\t\treq.Method = \"POST\";\n\t\t\tWriteJsonToRequest(req, jsonData);\n\n\t\t\tWebResponse response = req.GetResponse();\n\t\t\tstring responseString = ParseWebResponse(response);\n\t\t\treturn responseString;\n\t\t}\n\n\t\tprivate WebRequest AssembleWebRequest(string apiRoute, string jsonData = \"\")\n\t\t{\n\t\t\tstring url = domain + apiRoute + (apiRoute.Contains(\"?\")?\"&\":\"?\") + \"timestamp=\"+DateTime.Now.Ticks; \n\t\t\tWebRequest request = WebRequest.Create(url);\n\t\t\tstring authSig = CalcAuthSigHash(secKey, url + jsonData);\n\n\t\t\trequest.ContentType = \"application/json\";\n\t\t\trequest.Headers[\"X-Api-Key\"] = apiKey;\n\t\t\trequest.Headers[\"X-Api-Signature\"] = authSig;\n\t\t\trequest.Headers[\"X-Api-Version\"] = \"2\";\n\t\t\treturn request;\n\t\t}\n\n\t\tprivate void WriteJsonToRequest(WebRequest req, string jsonData)\n\t\t{\n\t\t\tvar streamWriter = new StreamWriter(req.GetRequestStream ());\n\t\t\tstreamWriter.Write(jsonData);\n\t\t\tstreamWriter.Close();\n\t\t}\n\n\t\tprivate byte[] GetBytes(string str)\n\t\t{\n\t\t\treturn Encoding.UTF8.GetBytes(str);\n\t\t}\n\n\t\tprivate string GetString(byte[] bytes)\n\t\t{\n\t\t\treturn BitConverter.ToString(bytes);\n\t\t}\n\n\t\tprivate string CalcAuthSigHash(string key, string value)\n\t\t{\n\t\t\tHMACSHA256 hmac = new HMACSHA256(GetBytes(key));\n\t\t\tstring hash = GetString(hmac.ComputeHash(GetBytes(value)));\n\t\t\thash = hash.Replace(\"-\", \"\");\n\t\t\treturn hash;\n\t\t}\n\n\t\tprivate string ParseWebResponse(WebResponse response)\n\t\t{\n\t\t\tStreamReader streamReader = new StreamReader(response.GetResponseStream());\n\t\t\tstring result = streamReader.ReadToEnd();\n\t\t\tstreamReader.Close();\n\t\t\treturn result;\n\t\t}\n\t}\n}", "language": "csharp" }, { "code": "<?php\n function make_authenticated_request($endpoint, $method, $body) {\n $url = 'https://api.sendwyre.com';\n $api_key = \"bh405n7stsuo5ut30iftrsl71b4iqjnv\";\n $secret_key = \"a19cvrchgja82urvn47kirrlrrb7stgg\";\n\n $timestamp = floor(microtime(true)*1000);\n $request_url = $url . $endpoint;\n\n if(strpos($request_url,\"?\"))\n $request_url .= '&timestamp=' . $timestamp;\n else\n $request_url .= '?timestamp=' . $timestamp;\n\n if(!empty($body))\n $body = json_encode($body, JSON_FORCE_OBJECT);\n else\n $body = '';\n\n $headers = array(\n \"Content-Type: application/json\",\n \"X-Api-Key: \". $api_key,\n \"X-Api-Signature: \". calc_auth_sig_hash($secret_key, $request_url . $body),\n \"X-Api-Version: 2\"\n );\n $curl = curl_init();\n\n if($method==\"POST\"){\n $options = array(\n CURLOPT_URL => $request_url,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $body,\n CURLOPT_RETURNTRANSFER => true);\n }else {\n $options = array(\n CURLOPT_URL => $request_url,\n CURLOPT_RETURNTRANSFER => true);\n }\n curl_setopt_array($curl, $options);\n curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\n $result = curl_exec($curl);\n curl_close($curl);\n var_dump($result);\n return json_decode($result, true);\n }\n\n function calc_auth_sig_hash($seckey, $val) {\n $hash = hash_hmac('sha256', $val, $seckey);\n return $hash;\n }\n\n\t\t$userData = array(\n \"type\"=>\"ENTERPRISE\",\n \"name\"=>\"{your-unique-identifier}\",\n \"callbackUrl\"=>\"https://your.website.io/callback\",\n \"notes\"=> \"Notes about the user\",\n \"verificationData\"=> array(\n \t\"firstName\"=> \"{users-first-name}\",\n \"middleName\"=> \"{users-middle-name}\",\n \"lastName\"=> \"{users-last-name}\",\n \"ssn\"=> \"0000\",\n \"passport\"=> \"12345\",\n \"birthDay\"=> \"1\",\n \"birthMonth\"=> \"1\",\n \"birthYear\"=> \"1970\",\n \"phoneNumber\"=> \"+15555555555\",\n \"address\"=> array(\n \"street1\":\"1 Market Street\",\n \"street2\":\"Suite 420\",\n \"city\":\"San Francisco\",\n \"state\":\"CA\",\n \"postalCode\":\"94105\",\n \"country\":\"US\"\n )\n )\n );\n\t\techo make_authenticated_request(\"/wallets\", \"POST\", $userData);\n?>", "language": "php" }, { "code": "#!/bin/bash\napiKey='P8Lc7vzwR6dSpWY'\nsecret='Atk0MZ1xSOlW250'\n\ntimestamp=`date +%s`\ntimestamp+=\"000\"\nurl='https://api.sendwyre.com/v2/wallets?timestamp='\nurl+=$timestamp\n\nbody='{\"type\":\"ENTERPRISE\",\"name\":\"{your-unique-identifier3}\",\"callbackUrl\":\"https://your.website.io/callback\",\"notes\":\"Notes about the sub account\",\"verificationData\":{\"firstName\":\"{users-first-name}\",\"middleName\":\"{users-middle-name}\",\"lastName\":\"{users-last-name}\",\"ssn\":\"0000\",\"passport\":\"123456\",\"birthDay\":\"1\",\"birthMonth\":\"1\",\"birthYear\":\"1970\",\"phoneNumber\":\"+15555555555\",\"address\":{\"street1\":\"1 Market Street\",\"street2\":\"Suite 420\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94105\",\"country\":\"US\"}}}'\n\ndata=$url\ndata+=$body\nsignature=`echo -n $data | openssl dgst -sha256 -hex -hmac $secret`\n\necho $apiKey\necho $signature\necho $url\n\ncurl -v -XPOST $url \\\n\t-H \"Content-Type: application/json\" \\\n -H \"X-Api-Key: $apiKey\" \\\n -H \"X-Api-Signature: $signature\" \\\n\t-H \"X-Api-Version: 2\" \\\n\t-d \"$body\"\n", "language": "shell" } ] } [/block] ## Response When a new user is created you will receive the following: - `name` - Your identifier - `id` - Wyre's identifier - `depositAddresses` - Digital currency deposit addresses for the user - `totalBalances` - Total balance for the user - `availableBalances` - Funds available to the user - `pusherChannel` - Pusher update channel - `srn` - Wyre Reference Name identifier - `balances` - Balances for the user - `callbackUrl` - Your callback url - `notes` - Your note for the user - `verificationData` - KYC information for the user [block:code] { "codes": [ { "code": "{\n \"name\" : \"{your-unique-identifier}\",\n \"id\" : \"AYBNA3lBiWAM4l3\",\n \"depositAddresses\" : {\n \"BTC\" : \"2ShL7kzSNNxedit6hC2fjSQhVcAucTeS1m7\"\n },\n \"totalBalances\" : {\n \"BTC\" : 0\n },\n \"availableBalances\" : {\n \"BTC\" : 0\n },\n \"srn\" : \"wallet:AYBNA3lBiWAM4l3\",\n \"balances\" : {\n \"BTC\" : 0\n },\n \"callbackUrl\" : \"https://your.website.io/callback\",\n \"notes\" : \"Notes about the user\"\n}", "language": "json", "name": "Full Response Object" } ] } [/block]