{"info":{"_postman_id":"289977ca-0631-4502-ad6a-f3270fabbb1c","name":"Swyft Open Delivery API (SODA™) Documentation","description":"<html><head></head><body><p>Thanks for looking at the Swyft Open Delivery API (SODA™) documentation! Below you will find API definitions, request and response instructions, and webhook definitions and examples to help you get familiar with the Swyft Locker integration and learn how to safely send your customer's packages to our lockers.</p>\n<p>Present-day delivery inefficiencies prompted Swyft to develop a merchant and parcel locker network open to all retailers and carriers. We have partnered with merchants both small (UN Market) and large (7-Eleven) to develop the first nationwide parcel delivery ecosystem to drive meaningful incremental foot traffic to stores and allow ecommerce marketplaces to offer secure counter and locker delivery. </p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"7337292","collectionId":"289977ca-0631-4502-ad6a-f3270fabbb1c","publishedId":"SWTK4E8u","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2020-02-10T21:13:47.000Z"},"item":[{"name":"Swyft","item":[{"name":"Parcel Locker Integration","item":[{"name":"Check Location Availability","event":[{"listen":"prerequest","script":{"id":"c7694282-0205-4daf-a73d-f58c3301b013","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\treturn hmac;","}","//const publicKey = \"o7D3GDXJ2NINozFgYjzu6epZwzVP7iTvTtEQfmesL5xGNPewWltZDCYoeiF5\"","//const secretKey = \"Pp9dFJ2dCgSpHaJpgmZHyGgfFsmxsarA0zKsKCm9\"","const publicKey = \"some_very_long_encrypted_api_key\"","const secretKey = \"some-super-long-private-key-encrypted-here\"","const ts = new Date().getTime();","const signature = createHmacString(secretKey, ts);","","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)","pm.environment.set(\"apiPublicKey\",publicKey)"],"type":"text/javascript"}},{"listen":"test","script":{"id":"b186c19a-3add-4031-93a1-96f8110dfea3","exec":["tests[\"Status code is 200\"] = responseCode.code === 200"],"type":"text/javascript"}}],"id":"105cb88b-eb54-4b2f-9fb6-860457d787b7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"max_distance\": \"500\",\n    \"is_ada\": \"false\",\n    \"address\": {\n        \"city\": \"San Bruno\",\n        \"state\": \"CA\"\n    },\n    \"order_dimensions\": {\n        \"h\": \"10\",\n        \"l\": \"10\",\n        \"w\": \"10\"\n    },\n    \"arrival_date\": \"2020-03-25\"\n}"},"url":"https://us-central1-swyft-locker.cloudfunctions.net/retail_integration/find_locations","description":"<p>Find a shipping location near the package's final destination.</p>\n","urlObject":{"protocol":"https","path":["retail_integration","find_locations"],"host":["us-central1-swyft-locker","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"615a623e-013b-429b-93c8-430d7f56c136","name":"Check Locker Availability","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n        \"max_distance\": 20,\n        \"is_ada\": false,\n        \"address\": {\n            \"city\": \"San Francisco\",\n            \"state\": \"CA\"\n        },\n        \"order_dimensions\": {\n            \"h\": 11,\n            \"l\": 8,\n            \"w\": 7\n        },\n        \"arrival_date\": \"2019-04-29\"\n    }"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/find_locations"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"12a-A/9vfZCrsuFBJL5DEekcy3DCnVY\""},{"key":"Function-Execution-Id","value":"v1dhwguu38gc"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"053ecaf834cece5192eddfe6dfe4d28f;o=1"},{"key":"Date","value":"Wed, 24 Apr 2019 20:35:03 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"298"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"available_location\": [\n        {\n            \"id\": \"7EUS0003\",\n            \"name\": \"7-Eleven - 1805 Sylvan Ave\",\n            \"address\": {\n                \"address1\": \"1805 Sylvan Ave\",\n                \"address2\": \"DropSpot Locker\",\n                \"city\": \"Dallas\",\n                \"state\": \"TX\",\n                \"zip\": 75208,\n                \"coordinates\": {\n                    \"lat\": 37.638002,\n                    \"lon\": -122.4194\n                },\n                \"distance\": 15.225643379181685\n            }\n        }\n    ],\n    \"message\": \"Available locations found.\"\n}"}],"_postman_id":"105cb88b-eb54-4b2f-9fb6-860457d787b7"},{"name":"Create an order with Swyft","event":[{"listen":"prerequest","script":{"id":"0e130497-49b0-46cf-b6b3-70b77ed2eb3d","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\t// \tconst hmac = CryptoJS.HmacSHA256(ts, privateKey).toString(CryptoJS.enc.Hex)","\treturn hmac;","}","const publicKey = \"some_very_long_encrypted_api_key\"","const ts = new Date().getTime();","const signature = createHmacString(\"some-super-long-private-key-encrypted-here\", ts);","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)","pm.environment.set(\"apiPublicKey\",publicKey)"],"type":"text/javascript"}},{"listen":"test","script":{"id":"8ea8b113-4dc4-4f31-91ea-42ada1a4ae92","exec":["tests[\"Status code is 200\"] = responseCode.code === 200"],"type":"text/javascript"}}],"id":"45b52abc-be8b-4200-8fd9-37af70357a86","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"location_id\": \"swyft0002\",\n    \"is_ada\": false,\n    \"notification_type\": [\n        \"sms\",\n        \"email/push\"\n    ],\n    \"order\": {\n        \"ageVerificationNeeded\": false,\n        \"arrival_date\": \"2020-03-22\",\n        \"carrier\": \"USPS\",\n        \"dimensions\": {\n            \"h\": 10,\n            \"w\": 10,\n            \"l\": 10\n        },\n        \"meta_data\": {},\n        \"id\": \"89wq94rdoasjf\",\n        \"status\": \"Shipped\",\n        \"tracking_number\": \"89yadfjaf7d8907988t879784098yb03\"\n    },\n    \"customer\": {\n        \"first_name\": \"Tom\",\n        \"last_name\": \"Manuel\",\n        \"email_address\": \"tmanuel@dropspot.com\",\n        \"phone_number\": \"650-451-2151\",\n        \"meta_data\": {}\n    }\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/create_order","description":"<p>Swyft requires you to create an order for your customers. This first step lets us know that you have a package being sent to one of our lockers. Swyft will handle communications with your customers updating them when a shipment has been created and also at the time of arrival.</p>\n<p><strong>Note:</strong> that the dimmensions object takes in the following key value pairs:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{\n    h: package height in centimeters,\n    w: package width in centimeters,\n    l: package length in centimeters\n}\n</code></pre>","urlObject":{"protocol":"https","path":["retail_integration","create_order"],"host":["us-central1-swyft-locker-qa","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"086930c6-270f-499c-a342-d380eecc93d8","name":"Create an order with Swyft","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"location_id\": \"swyft0001\",\n    \"is_ada\": false,\n    \"order\": {\n        \"id\": \"9n33jjyf93fjaou3ro87dbvxz\",\n        \"tracking_number\": \"900000000000000000009908003\",\n        \"carrier\": \"USPS\",\n        \"dimensions\": {\n            \"h\": 11,\n            \"w\": 8,\n            \"l\": 7\n        },\n        \"arrival_date\": \"2019-05-07T14:48:00.000Z\",\n        \"status\": \"shipped\",\n        \"meta_data\": {}\n    },\n    \"customer\": {\n        \"first_name\": \"Quinn\",\n        \"last_name\": \"Cook\",\n        \"email_address\": \"qcook@yopmail.com\",\n        \"meta_data\": {}\n    }\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/create_order"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"72-b347Ka83HO8VaBS1ocwAGXe3BDI\""},{"key":"Function-Execution-Id","value":"709t4d4m87q9"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"49554d5fc7994240389c150b0c5fc0bd;o=1"},{"key":"Date","value":"Thu, 18 Apr 2019 23:20:06 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"114"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"confirmation_number\": \"swyft0001_1555629604502\",\n    \"pick_up_code\": \"742282\",\n    \"message\": \"Order Created\"\n}"}],"_postman_id":"45b52abc-be8b-4200-8fd9-37af70357a86"},{"name":"Update an order","event":[{"listen":"prerequest","script":{"id":"b0b7ad36-0fdd-4cc9-acbc-b9303fd512b3","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\t// \tconst hmac = CryptoJS.HmacSHA256(ts, privateKey).toString(CryptoJS.enc.Hex)","\treturn hmac;","}","const publicKey = \"some_very_long_encrypted_api_key\"","const ts = new Date().getTime();","const signature = createHmacString(\"some-super-long-private-key-encrypted-here\", ts);","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)","pm.environment.set(\"apiPublicKey\",publicKey)"],"type":"text/javascript"}},{"listen":"test","script":{"id":"83a63735-340a-48c2-9794-dc4ba7e502db","exec":["tests[\"Status code is 200\"] = responseCode.code === 200"],"type":"text/javascript"}}],"id":"0fd0e626-9dcd-4ab6-82e7-355b854987c7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"location_id\": \"SwyftLockerID\",\n    \"is_ada\": false,\n    \"order\": {\n        \"id\": \"YourStoreOrderID\",\n        \"tracking_number\": \"YourTrackingOrOrderNumber\",\n        \"carrier\": \"YourCarrier\",\n        \"dimensions\": {\n            \"h\": 11,\n            \"w\": 8,\n            \"l\": 7\n        },\n        \"arrival_date\": \"2019-04-27T14:48:00.000Z\",\n        \"status\": \"YourShippingStatus\",\n        \"meta_data\": {}\n    },\n    \"customer\": {\n        \"first_name\": \"Jane\",\n        \"last_name\": \"Doe\",\n        \"email_address\": \"jdoe@theiremail.com\",\n        \"meta_data\": {}\n    }\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/update_order/swyft0001_1555631437618","description":"<p>Update an order for your users. Scenarios include change of arrival date, package detail changes or anything that relates to your customer's package.</p>\n<p>Every field that is accepted in the create order endpoint is optional here. The headers are still required to be passed in with an HMAC signature.</p>\n<p>To cancel an order, update the order with an order status of 'canceled'</p>\n","urlObject":{"protocol":"https","path":["retail_integration","update_order","swyft0001_1555631437618"],"host":["us-central1-swyft-locker-qa","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"dfcd5629-4132-4d9e-a280-12b3f1692a9f","name":"Order update with status set as `canceled`","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"locker_id\": \"swyft0001\",\n    \"order\": {\n        \"status\": \"canceled\"\n    }\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/update_order/swyft0001_1555703183686"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"64-06fei6ACLd6XmUWK311ILIz3emc\""},{"key":"Function-Execution-Id","value":"gm8nv4347nhb"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"3c3f848cd4d9e373c5f6a3bf66b5f767;o=1"},{"key":"Date","value":"Fri, 19 Apr 2019 20:00:39 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"100"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Order has been canceled.\",\n    \"confirmationNumber\": \"swyft0001_1555703183686\"\n}"},{"id":"e66f3ced-4e0b-4627-aa6f-eeab9c60693f","name":"Update an order","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"location_id\": \"swyft0001\",\n    \"is_ada\": false,\n    \"order\": {\n        \"tracking_number\": \"900000000000000000009908008\",\n        \"carrier\": \"USPS\",\n        \"dimensions\": {\n            \"h\": 11,\n            \"w\": 8,\n            \"l\": 7\n        },\n        \"arrival_date\": \"2019-05-17T14:48:00.000Z\",\n        \"status\": \"canceled\",\n        \"meta_data\": {}\n    },\n    \"customer\": {\n        \"first_name\": \"Quinn\",\n        \"last_name\": \"Cook\",\n        \"email_address\": \"qcook@yopmail.com\",\n        \"meta_data\": {}\n    }\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/update_order/swyft0001_1555644070922"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"63-i5E1OiF0aFvHJLW0DpqqMVJk950\""},{"key":"Function-Execution-Id","value":"pmxtqa4loq9a"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"7470ec630b1f588affa89503a690e33f;o=1"},{"key":"Date","value":"Fri, 19 Apr 2019 04:20:50 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"99"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Order updated properly.\",\n    \"confirmationNumber\": \"swyft0001_1555644070922\"\n}"}],"_postman_id":"0fd0e626-9dcd-4ab6-82e7-355b854987c7"},{"name":"Webhook Urls","event":[{"listen":"prerequest","script":{"id":"c7694282-0205-4daf-a73d-f58c3301b013","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\t// \tconst hmac = CryptoJS.HmacSHA256(ts, privateKey).toString(CryptoJS.enc.Hex)","\treturn hmac;","}","","let ts = new Date().getTime();","const signature = createHmacString(\"some-super-long-private-key-encrypted-here\", ts);","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)"],"type":"text/javascript"}},{"listen":"test","script":{"id":"b186c19a-3add-4031-93a1-96f8110dfea3","exec":["tests[\"Status code is 200\"] = responseCode.code === 200"],"type":"text/javascript"}}],"id":"5e0e1df7-896d-4d0d-8221-49d9fc6ce612","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"target_url\": \"https://yourstoreapi.com/webhookUrl\"\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/enroll_web_hook","description":"<p>Webhook urls are endpoints that live on your servers that allow us to send you package information. This is how you get updates on the packages that you send. For instance, we will notify you at this URL when a package arrives at and gets checked in to a locker. We will send complete order information that you can then consume in your environment.</p>\n<p>An example post will look like the following:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>const body = {\n    \"order_id\": theOrderId,\n    \"order_status\": orderStatus,\n    \"order_url\": getOrderUrl\n}\n</code></pre><p>The request will also contain the hmac sinature in the header for you to validate that the request is coming from our servers. </p>\n","urlObject":{"protocol":"https","path":["retail_integration","enroll_web_hook"],"host":["us-central1-swyft-locker-qa","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"b25533f6-766e-4ba8-a45b-e36858e698a9","name":"Webhook Urls","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{\n    \"target_url\": \"https://yourstoreapi.com/webhookUrl\"\n}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/enroll_web_hook"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"61-d8CSTAhdt1YJREz1OIQXFVCk9Dw\""},{"key":"Function-Execution-Id","value":"lylp7bwbu9gx"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"29480f0c811ab00a020a9912e1c971e8;o=1"},{"key":"Date","value":"Wed, 24 Apr 2019 21:16:57 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"97"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Successfuly subscribed with url: https://yourstoreapi.com/webhookUrl\"\n}"}],"_postman_id":"5e0e1df7-896d-4d0d-8221-49d9fc6ce612"},{"name":"Cancel Webhook Url","event":[{"listen":"prerequest","script":{"id":"c7694282-0205-4daf-a73d-f58c3301b013","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\t// \tconst hmac = CryptoJS.HmacSHA256(ts, privateKey).toString(CryptoJS.enc.Hex)","\treturn hmac;","}","","let ts = new Date().getTime();","const signature = createHmacString(\"some-super-long-private-key-encrypted-here\", ts);","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)"],"type":"text/javascript"}},{"listen":"test","script":{"id":"b186c19a-3add-4031-93a1-96f8110dfea3","exec":["tests[\"Status code is 200\"] = responseCode.code === 200"],"type":"text/javascript"}}],"id":"fbaa4c72-d46f-4a70-93a1-af48226e2399","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":"{}"},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/cancel_web_hook/","description":"<p>You can unsubscribe and cancel your webhook url by simply passing us the orgID.</p>\n","urlObject":{"protocol":"https","path":["retail_integration","cancel_web_hook",""],"host":["us-central1-swyft-locker-qa","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"585e1ba5-f456-4417-b5f1-04ba91e1f075","name":"Cancel Webhook Url","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":""},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/cancel_web_hook/"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"35-t0+oDOcS7Y2emFVUpFq1Or6sxuY\""},{"key":"Function-Execution-Id","value":"lylpw8gjmwsa"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"58aafd8c168f63939f32ac9b6edfc91b;o=1"},{"key":"Date","value":"Wed, 24 Apr 2019 21:17:25 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"53"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Successfuly unsubscribed\"\n}"},{"id":"bdabf0d0-9785-40db-882b-cbcc3671866c","name":"Cancel Webhook Url","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"body":{"mode":"raw","raw":""},"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/cancel_web_hook/"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"35-t0+oDOcS7Y2emFVUpFq1Or6sxuY\""},{"key":"Function-Execution-Id","value":"lylpw8gjmwsa"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"58aafd8c168f63939f32ac9b6edfc91b;o=1"},{"key":"Date","value":"Wed, 24 Apr 2019 21:17:25 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"53"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,44,43,39\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Successfuly unsubscribed\"\n}"}],"_postman_id":"fbaa4c72-d46f-4a70-93a1-af48226e2399"},{"name":"Get Order","event":[{"listen":"prerequest","script":{"id":"8e34cf48-7f5c-435e-a295-c3bcd07ae7c6","exec":["const createHmacString = (privateKey, ts) => {","    const key = CryptoJS.enc.Utf8.parse(privateKey)","\tconst timestamp = CryptoJS.enc.Utf8.parse(ts)","\tconst hmac = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(timestamp, key))","\t","\t// \tconst hmac = CryptoJS.HmacSHA256(ts, privateKey).toString(CryptoJS.enc.Hex)","\treturn hmac;","}","const publicKey = \"some_very_long_encrypted_api_key\"","//const ts = new Date().getTime();","const ts = 1581629576362","const signature = createHmacString(\"some-super-long-private-key-encrypted-here\", ts);","console.log(\"sign\", signature);","pm.environment.set(\"ts\", ts)","pm.environment.set(\"signature\", signature)","pm.environment.set(\"apiPublicKey\",publicKey)"],"type":"text/javascript"}}],"id":"7f3829db-a1d8-41a9-80e5-d986126f5ee5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"<p>Public key generated by Swyft. See the generate keys section to get yours. </p>\n","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"<p>Signatures are unique HMAC tokens required with each request</p>\n","key":"signature","type":"text","value":"{{signature}}"},{"description":"<p>This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.</p>\n","key":"ts","type":"text","value":"{{ts}}"}],"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/get_order/swyft0001_1581034056902","description":"<p>Returns exisiting order details for the passed in Order Id</p>\n","urlObject":{"protocol":"https","path":["retail_integration","get_order","swyft0001_1581034056902"],"host":["us-central1-swyft-locker-qa","cloudfunctions","net"],"query":[],"variable":[]}},"response":[{"id":"202e3736-cba7-4ec7-aa4b-84e26c676efa","name":"Get Order","originalRequest":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"description":"Public key generated by Swyft. See the generate keys section to get yours. ","key":"public_key","type":"text","value":"{{apiPublicKey}}"},{"description":"Signatures are unique HMAC tokens required with each request","key":"signature","type":"text","value":"{{signature}}"},{"description":"This is an Epoch timestamp for the request. All request will be evaulated and expire after five minutes.","key":"ts","type":"text","value":"{{ts}}"}],"url":"https://us-central1-swyft-locker-qa.cloudfunctions.net/retail_integration/get_order/swyft0001_1581034056902"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Etag","value":"W/\"1ab-zUITpXlQGSo1/CHctuQpJF2+0cQ\""},{"key":"Function-Execution-Id","value":"80uo3tpdkos5"},{"key":"X-Powered-By","value":"Express"},{"key":"X-Cloud-Trace-Context","value":"a9beb83782ebe15eba31968d480d061e;o=1"},{"key":"Date","value":"Thu, 13 Feb 2020 18:27:17 GMT"},{"key":"Server","value":"Google Frontend"},{"key":"Content-Length","value":"427"},{"key":"Alt-Svc","value":"quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Order found\",\n    \"order\": {\n        \"is_ada\": false,\n        \"tracking_number\": \"89yadfjaf7d8907988\",\n        \"customer_email\": \"qcook@yopmail.com\",\n        \"location_id\": \"swyft0001\",\n        \"carrier\": \"USPS\",\n        \"dimension\": {\n            \"h\": 11,\n            \"l\": 7,\n            \"w\": 8\n        },\n        \"arrival_date\": \"2020-02-22T00:00:00.000Z\",\n        \"last_updated\": \"2020-02-07T00:07:36.881Z\",\n        \"check_in_date\": \"Package has not arrived\",\n        \"check_out_date\": \"Package has not arrived\",\n        \"status\": \"pending-dropoff\"\n    }\n}"}],"_postman_id":"7f3829db-a1d8-41a9-80e5-d986126f5ee5"}],"id":"26c15f66-5803-40b9-9e6f-99ecea3fc9ca","description":"<p>This documentation contains a description on how to securely sign Swyft/Retail integration requests. In this document we will cover how to use a private key to generate an HMAC security token.</p>\n","event":[{"listen":"prerequest","script":{"id":"0ed6d77a-c856-44ef-9162-244b77aef7ed","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"079914a9-ae67-4960-9d2a-c34106b2e6fb","type":"text/javascript","exec":[""]}}],"_postman_id":"26c15f66-5803-40b9-9e6f-99ecea3fc9ca"}],"id":"19dec46b-8851-4155-acb6-fbc45f9e1def","description":"<p>Allow your customers to send packages directly to a locker near them. Sending packages to a locker allows them to safely store their packages in a secured locker and helps in securing the safe delivery of your valuable merchandise.</p>\n<h2 id=\"note-on-requests\">Note on requests</h2>\n<p>An API secret and public key will be required for you to access the required API endpoints. These keys should be assigned to you upon request. You will use the public and secret keys to generate an HMAC authentication string that contains a timestamp. This will generate a new key for every request.</p>\n<h3 id=\"how-to-create-an-hmac-script\">How to create an HMAC script</h3>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>const crypto = require('crypto');\nconst generateHmac = (privateKey, ts) =&gt; {\n    const hmac = crypto.createHmac('sha256', privateKey);\n    hmac.update(ts);\n    const signature = hmac.digest('hex');\n    return signature;\n}\n</code></pre>","event":[{"listen":"prerequest","script":{"id":"7827c810-95a9-449b-bfb1-ff3351cef005","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"9b460059-7c83-43ba-9c1c-8647f88e8015","type":"text/javascript","exec":[""]}}],"_postman_id":"19dec46b-8851-4155-acb6-fbc45f9e1def"}],"event":[{"listen":"prerequest","script":{"id":"744bc134-b70a-42a9-8f5f-e3418eed59d1","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"eb48fef0-2e40-4d8e-8f49-cb21d2ad92b6","type":"text/javascript","exec":[""]}}]}