{"__v":16,"_id":"55fa3c3ba663c00d00773dce","category":{"__v":7,"_id":"55fa37ca8065a10d004e5bb7","pages":["55fa37ca8065a10d004e5bbb","55fa37ca8065a10d004e5bbc","55fa37ca8065a10d004e5bbd","55fa37ca8065a10d004e5bbe","55fa37ca8065a10d004e5bbf","55fa37ca8065a10d004e5bc0","55fa3a948065a10d004e5bd5","55fa3c3ba663c00d00773dce","55fa4b8eaba81f0d00a115e4","56733ae758c4890d00bb548a","56734f9c4b2a680d00524e09","569d8eae3dbdc20d005feee8"],"project":"54e405191e51932d006abc39","version":"55fa37c88065a10d004e5bb6","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-18T03:20:58.779Z","from_sync":false,"order":0,"slug":"introduction","title":"Introduction"},"parentDoc":null,"project":"54e405191e51932d006abc39","user":"54e4044e8ef7552300409dcb","version":{"__v":7,"_id":"55fa37c88065a10d004e5bb6","project":"54e405191e51932d006abc39","createdAt":"2015-09-17T03:47:20.956Z","releaseDate":"2015-09-17T03:47:20.956Z","categories":["55fa37ca8065a10d004e5bb7","55fa37ca8065a10d004e5bb8","55fa37ca8065a10d004e5bb9","55fa37ca8065a10d004e5bba","55fca6bf34ae7c0d00ab8ea0","55ff80fd9e7ccf0d000a1d93","560220af7435de0d00fabd0d","56107f21bb9d920d00303e70","563e184077681a0d00d96a02","56fafc6596ec7e0e002ac85f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"REST V3","version_clean":"3.1.0","version":"3.1"},"updates":["56071fc33a93940d002b3f1e"],"next":{"pages":[],"description":""},"createdAt":"2015-09-17T04:06:19.096Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Instead of adding authentication information in the payload like Core V3, this version of the API allows you to add the authentication and user information in the header.  This will make payloads smaller and easier to follow. These are the values you are expected to supply in the header.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"KEY\",\n    \"h-1\": \"VALUE\",\n    \"h-2\": \"Comments\",\n    \"h-3\": \"Notes\",\n    \"0-0\": \"X-SP-GATEWAY\",\n    \"0-1\": \"CLIENT_ID|CLIENT_SECRET\",\n    \"0-2\": \"Developer’s client_id and secret\",\n    \"0-3\": \"You can send bulk instructions here\",\n    \"1-0\": \"X-SP-USER\",\n    \"1-1\": \"OAUTH_KEY|FINGERPRINT\",\n    \"1-2\": \"User’s Oauth_key and device fingerprint\",\n    \"1-3\": \"Paginated. Search by name and email available\",\n    \"2-1\": \"IP.ADD.OF.USR\",\n    \"2-0\": \"X-SP-USER-IP\",\n    \"2-2\": \"IP Address of the user\",\n    \"2-3\": \"Allows you to register a new user to SynapsePay\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"\"\n}\n[/block]\n##Client App Initialization\n\nInstead of using the API directly, you can also use our Client libraries to interface with REST V3. Following is how you initialize the environment for the libraries.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from synapse_pay_rest import Client\\n\\nrequired = {\\n    'client_id': '', # your client id\\n    'client_secret': '', # your client secret\\n    'fingerprint': '', # user's fingerprint\\n    'ip_address': '', # user's IP\\n}\\n\\noptions = {\\n    'development_mode': True, # default False\\n    'logging': False # logs to stdout if True\\n}\\n\\nclient = Client(**required, **options)\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"const SynapsePay = require('synapsepay');\\nconst Clients = SynapsePay.Clients;\\nconst Users = SynapsePay.Users;\\nconst Nodes = SynapsePay.Nodes;\\nconst Transactions = SynapsePay.Transactions;\\n\\nconst client = new Clients(\\n    'YOUR_CLIENT_ID',\\n    'YOUR_CLIENT_SECRET',\\n    IS_PRODUCTION # boolean\\n);\",\n      \"language\": \"javascript\",\n      \"name\": \"Node.js\"\n    },\n    {\n      \"code\": \"require 'synapse_pay_rest'\\n\\nargs = {\\n  # synapse client_id\\n  client_id:        '',\\n  # synapse client_secret\\n  client_secret:    '',\\n  # a hashed value, either unique to user or static for app\\n  fingerprint:      '',\\n  # the user's IP\\n  ip_address:       '',\\n  # (optional) requests go to sandbox endpoints if true\\n  development_mode: true,\\n  # (optional) if true logs requests to stdout\\n  logging:          true,\\n  # (optional) file path to write logs to\\n  log_to:           nil\\n}\\n\\nclient = SynapsePayRest::Client.new(args)\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"require(dirname(__FILE__) . '/../../init.php');\\n\\nuse SynapsePayRest\\\\Client;\\n\\n$options = array(\\n    'oauth_key'=> USER_OAUTH KEY, # Optional,\\n    'fingerprint'=> USER_FINGERPRINT,\\n    'client_id'=> YOUR_CLIENT_ID,\\n    'client_secret'=> YOUR_CLIENT_SECRET,\\n    'development_mode'=> true, #True will ping sandbox.synapsepay.com\\n    'ip_address'=> USER_IP_ADDRESS\\n);\\n\\n\\n$user = A_SYNAPSE_USER_OBJECT\\n\\n$client = new Client($options, $user['_id']); # USER_ID Optional\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nPlease note that you do not need to add oauth_key in the options dictionary after the user is created and oauth is performed. The libraries automatically do that for you.","excerpt":"Following are the values you need to set in the header of your API call","slug":"api-initialization","type":"basic","title":"API Initialization"}

API Initialization

Following are the values you need to set in the header of your API call

Instead of adding authentication information in the payload like Core V3, this version of the API allows you to add the authentication and user information in the header. This will make payloads smaller and easier to follow. These are the values you are expected to supply in the header. [block:parameters] { "data": { "h-0": "KEY", "h-1": "VALUE", "h-2": "Comments", "h-3": "Notes", "0-0": "X-SP-GATEWAY", "0-1": "CLIENT_ID|CLIENT_SECRET", "0-2": "Developer’s client_id and secret", "0-3": "You can send bulk instructions here", "1-0": "X-SP-USER", "1-1": "OAUTH_KEY|FINGERPRINT", "1-2": "User’s Oauth_key and device fingerprint", "1-3": "Paginated. Search by name and email available", "2-1": "IP.ADD.OF.USR", "2-0": "X-SP-USER-IP", "2-2": "IP Address of the user", "2-3": "Allows you to register a new user to SynapsePay" }, "cols": 3, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "" } [/block] ##Client App Initialization Instead of using the API directly, you can also use our Client libraries to interface with REST V3. Following is how you initialize the environment for the libraries. [block:code] { "codes": [ { "code": "from synapse_pay_rest import Client\n\nrequired = {\n 'client_id': '', # your client id\n 'client_secret': '', # your client secret\n 'fingerprint': '', # user's fingerprint\n 'ip_address': '', # user's IP\n}\n\noptions = {\n 'development_mode': True, # default False\n 'logging': False # logs to stdout if True\n}\n\nclient = Client(**required, **options)", "language": "python" }, { "code": "const SynapsePay = require('synapsepay');\nconst Clients = SynapsePay.Clients;\nconst Users = SynapsePay.Users;\nconst Nodes = SynapsePay.Nodes;\nconst Transactions = SynapsePay.Transactions;\n\nconst client = new Clients(\n 'YOUR_CLIENT_ID',\n 'YOUR_CLIENT_SECRET',\n IS_PRODUCTION # boolean\n);", "language": "javascript", "name": "Node.js" }, { "code": "require 'synapse_pay_rest'\n\nargs = {\n # synapse client_id\n client_id: '',\n # synapse client_secret\n client_secret: '',\n # a hashed value, either unique to user or static for app\n fingerprint: '',\n # the user's IP\n ip_address: '',\n # (optional) requests go to sandbox endpoints if true\n development_mode: true,\n # (optional) if true logs requests to stdout\n logging: true,\n # (optional) file path to write logs to\n log_to: nil\n}\n\nclient = SynapsePayRest::Client.new(args)", "language": "ruby" }, { "code": "require(dirname(__FILE__) . '/../../init.php');\n\nuse SynapsePayRest\\Client;\n\n$options = array(\n 'oauth_key'=> USER_OAUTH KEY, # Optional,\n 'fingerprint'=> USER_FINGERPRINT,\n 'client_id'=> YOUR_CLIENT_ID,\n 'client_secret'=> YOUR_CLIENT_SECRET,\n 'development_mode'=> true, #True will ping sandbox.synapsepay.com\n 'ip_address'=> USER_IP_ADDRESS\n);\n\n\n$user = A_SYNAPSE_USER_OBJECT\n\n$client = new Client($options, $user['_id']); # USER_ID Optional", "language": "php" } ] } [/block] Please note that you do not need to add oauth_key in the options dictionary after the user is created and oauth is performed. The libraries automatically do that for you.