{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/v2/wallet/{walletId}/update","auth":"required","settings":"","results":{"codes":[]},"params":[],"examples":{"codes":[]},"method":"post"},"next":{"description":"","pages":[]},"title":"Update Wallet","type":"endpoint","slug":"update-wallet","excerpt":"","body":"#Update a MassPay user\n\n## Building the update request\n\nWhen building your Update request you'll need to use 1 out of these 5 fields:\n- `walletId` - The identifier for the wallet\n- `name` - Updated identifier for the user\n- `callbackUrl` - Updated child wallet callback url\n- `notes` - Updated notes about the user\n- `verificationData` - Updated KYC information about the user\n\n## Api Endpoint\nhttps://api.sendwyre.com/v2/wallet/{walletId}/update\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\": \"walletId\",\n    \"0-1\": \"String\",\n    \"0-2\": \"ID of wallet to update\",\n    \"0-3\": \"true\",\n    \"1-0\": \"name\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Updated identifier for the user\",\n    \"1-3\": \"false\",\n    \"2-0\": \"callbackUrl\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Updated callback\",\n    \"2-3\": \"false\",\n    \"3-0\": \"notes\",\n    \"3-1\": \"String\",\n    \"3-2\": \"Updated notes\",\n    \"3-3\": \"false\",\n    \"4-0\": \"verificationData\",\n    \"4-1\": \"Object\",\n    \"4-2\": \"Updated KYC information\",\n    \"4-3\": \"false\"\n  },\n  \"cols\": 4,\n  \"rows\": 5\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -XPOST 'https://api.sendwyre.com/v2/wallet/{wallet-id}/update' \\\\\\n\\t-H \\\"Content-Type: application/json\\\" \\\\\\n  -H \\\"X-Api-Key: {api-key}\\\" \\\\\\n  -H \\\"X-Api-Signature: {signature}\\\" \\\\\\n\\t-d '{\\\"name\\\":\\\"{your-unique-identifier}\\\",\\\"notes\\\":\\\"Updated notes about the sub account\\\"}'\",\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\\t\\n    String walletId = \\\"{wallet-id}\\\";\\n    \\n\\t\\tString url = \\\"https://api.sendwyre.com/v2/wallet/\\\"+ walletId +\\\"/update\\\";\\n\\t\\tString method = \\\"POST\\\";\\n\\t\\tString data = \\\"\\\";\\n\\n\\t\\tString result = excuteWyreRequest(url, \\\"\\\", method, apiKey, secretKey);\\n\\t\\tSystem.out.println(result);\\n\\n\\t\\tdata = \\\"{\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"name\\\\\\\":\\\\\\\"{your-unique-identifier}\\\\\\\",\\\" +\\n\\t\\t\\t\\t\\\"  \\\\\\\"notes\\\\\\\":\\\\\\\"Updated notes about the user\\\\\\\"\\\" +\\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 update_user(self, walletId, name, callbackUrl, notes, verificationData):\\n        url = self.api_url + '/wallet/' + walletId + '/update\\n        method = 'POST'\\n        body = {'name':name}\\n        if callbackUrl:\\n            body[\\\"callbackUrl\\\"] = callbackUrl\\n        if notes:\\n            body['notes'] = notes\\n        if verificationData:\\n          \\tbody['verificationData'] = verificationData\\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.update_user(\\n  \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"{wallet-id}\\\",\\n                                \\\"{your-unique-identifier}\\\", \\n                                None, #callbackUrl\\n                                \\\"Updated notes for user\\\",\\n                                None #verification data\\n\\t\\t\\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    }\n  ]\n}\n[/block]","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5f279f5d58188a00532f565d","createdAt":"2020-08-03T05:23:41.689Z","user":"5f279b5f85a619021c4073ad","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Wallets","slug":"wallet","order":6,"from_sync":false,"reference":false,"_id":"5f276e5348d2b600321aef9b","createdAt":"2020-08-03T01:54:28.004Z","version":"550f75de61d9d30d00af9e01","project":"550f74bb6fc8130d0038aad3","__v":0},"version":{"version":"3","version_clean":"3.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["550f75de61d9d30d00af9e02","551027e38579861900a86698","551029e08579861900a8669a","551029e7498062190006328a","5bc633a722d682005c9ad9e4","5bc633b08c4b0b000d6a7eaa","5bc633b48f3ff600626e3e18","5bc63538e5a6ba000d22ee6d","5bc63587a18a6b000decd295","5bc635c0937fcb0056223d9c","5bc6360f42f41800319aeaa6","5be5d13ff1d319002baca9ce","5be5d2287cd14d00291fbfdb","5be8b3b09f7cb70023c56a39","5be8b3cbb910100044e20206","5c1d769a4f6aed001fe527f0","5c402942010f0d001496dded","5e8127d61c906800374eeb1c","5f2768c98622b8005106544a","5f2768d05702ca0011f7655e","5f276e5348d2b600321aef9b","5f276fd300e519001139200a","5f9a2cb79dafe500259281a7"],"_id":"550f75de61d9d30d00af9e01","__v":23,"releaseDate":"2015-03-23T02:09:34.221Z","project":"550f74bb6fc8130d0038aad3","createdAt":"2015-03-23T02:09:34.221Z","forked_from":"550f74bb6fc8130d0038aad6"},"project":"550f74bb6fc8130d0038aad3","__v":0,"parentDoc":null}

Definition

{{ api_url }}{{ page_api_url }}

Documentation

#Update a MassPay user ## Building the update request When building your Update request you'll need to use 1 out of these 5 fields: - `walletId` - The identifier for the wallet - `name` - Updated identifier for the user - `callbackUrl` - Updated child wallet callback url - `notes` - Updated notes about the user - `verificationData` - Updated KYC information about the user ## Api Endpoint https://api.sendwyre.com/v2/wallet/{walletId}/update ## Params [block:parameters] { "data": { "h-0": "key", "h-1": "type", "h-2": "description", "h-3": "required", "0-0": "walletId", "0-1": "String", "0-2": "ID of wallet to update", "0-3": "true", "1-0": "name", "1-1": "String", "1-2": "Updated identifier for the user", "1-3": "false", "2-0": "callbackUrl", "2-1": "String", "2-2": "Updated callback", "2-3": "false", "3-0": "notes", "3-1": "String", "3-2": "Updated notes", "3-3": "false", "4-0": "verificationData", "4-1": "Object", "4-2": "Updated KYC information", "4-3": "false" }, "cols": 4, "rows": 5 } [/block] [block:code] { "codes": [ { "code": "curl -v -XPOST 'https://api.sendwyre.com/v2/wallet/{wallet-id}/update' \\\n\t-H \"Content-Type: application/json\" \\\n -H \"X-Api-Key: {api-key}\" \\\n -H \"X-Api-Signature: {signature}\" \\\n\t-d '{\"name\":\"{your-unique-identifier}\",\"notes\":\"Updated notes about the sub account\"}'", "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\t\n String walletId = \"{wallet-id}\";\n \n\t\tString url = \"https://api.sendwyre.com/v2/wallet/\"+ walletId +\"/update\";\n\t\tString method = \"POST\";\n\t\tString data = \"\";\n\n\t\tString result = excuteWyreRequest(url, \"\", method, apiKey, secretKey);\n\t\tSystem.out.println(result);\n\n\t\tdata = \"{\" +\n\t\t\t\t\" \\\"name\\\":\\\"{your-unique-identifier}\\\",\" +\n\t\t\t\t\" \\\"notes\\\":\\\"Updated notes about the user\\\"\" +\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 update_user(self, walletId, name, callbackUrl, notes, verificationData):\n url = self.api_url + '/wallet/' + walletId + '/update\n method = 'POST'\n body = {'name':name}\n if callbackUrl:\n body[\"callbackUrl\"] = callbackUrl\n if notes:\n body['notes'] = notes\n if verificationData:\n \tbody['verificationData'] = verificationData\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.update_user(\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"{wallet-id}\",\n \"{your-unique-identifier}\", \n None, #callbackUrl\n \"Updated notes for user\",\n None #verification data\n\t\t\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" } ] } [/block]