{"_id":"54cc2149380ecd0d00ca18d1","project":"5436a1e1d0ffee0e00f18f8c","user":"5436a1afb7cf0e1c0020d9ca","category":{"_id":"54cc2149380ecd0d00ca18b0","pages":["54cc2149380ecd0d00ca18ca","54cc2149380ecd0d00ca18cb","54cc2149380ecd0d00ca18cc","54cc2149380ecd0d00ca18cd","54cc2149380ecd0d00ca18ce","54cc2149380ecd0d00ca18cf","54cc2149380ecd0d00ca18d0","54cc2149380ecd0d00ca18d1"],"project":"5436a1e1d0ffee0e00f18f8c","__v":1,"version":"54cc2148380ecd0d00ca18aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-23T19:03:27.816Z","from_sync":false,"order":6,"slug":"ruby-client","title":"Ruby client"},"parentDoc":null,"version":{"_id":"54cc2148380ecd0d00ca18aa","__v":2,"forked_from":"5436a1e1d0ffee0e00f18f8f","project":"5436a1e1d0ffee0e00f18f8c","createdAt":"2015-01-31T00:26:48.753Z","releaseDate":"2015-01-31T00:26:48.753Z","categories":["54cc2149380ecd0d00ca18ab","54cc2149380ecd0d00ca18ac","54cc2149380ecd0d00ca18ad","54cc2149380ecd0d00ca18ae","54cc2149380ecd0d00ca18af","54cc2149380ecd0d00ca18b0","54cc2149380ecd0d00ca18b1","54cc2149380ecd0d00ca18b2","54cc2149380ecd0d00ca18b3","552f29ca633a5b0d00e99d09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"__v":3,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-23T19:37:03.264Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":7,"body":"The ShippingEasy API will hit a callback URL when an order, or a part of an order, has been shipped. The request to the callback URL will be also signed with the same shared secret found in the store's API settings.\n\nThis gem provides an Authenticator to handle verifying the signed request from ShippingEasy. Here's an example of how to use it (after you configured the library with your credentials in the step above):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ShippingEasy::Authenticator.new(method: :post, path: \\\"/callback\\\", params: {\\\"api_signature\\\" => \\\"asdsadsad\\\"}, body: \\\"{\\\\\\\"shipment\\\\\\\":{\\\\\\\"id\\\\\\\":\\\\\\\"1234\\\\\\\"}}\\\").signatures_match?\\n# => true\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nThe arguments for the method are:\n\n* **method** - The method of the http request. E.g. \"post\" or \"get\".\n* **path** - The path of the request's uri. E.g. \"/orders/callback\"\n* **params** - An associative array of the request's query string parameters. E.g.{\"api_signature\" => \"asdsadsad\", \"api_timestamp\" => \"1234567899\"}\n* **body** - The request body as a JSON string.\n* **api_secret** - Optional. The ShippingEasy API secret for the customer account. Defaults to the global configuration if set.","excerpt":"","slug":"callback-authentication","type":"basic","title":"Callback Authentication"}

Callback Authentication


The ShippingEasy API will hit a callback URL when an order, or a part of an order, has been shipped. The request to the callback URL will be also signed with the same shared secret found in the store's API settings. This gem provides an Authenticator to handle verifying the signed request from ShippingEasy. Here's an example of how to use it (after you configured the library with your credentials in the step above): [block:code] { "codes": [ { "code": "ShippingEasy::Authenticator.new(method: :post, path: \"/callback\", params: {\"api_signature\" => \"asdsadsad\"}, body: \"{\\\"shipment\\\":{\\\"id\\\":\\\"1234\\\"}}\").signatures_match?\n# => true", "language": "ruby" } ] } [/block] The arguments for the method are: * **method** - The method of the http request. E.g. "post" or "get". * **path** - The path of the request's uri. E.g. "/orders/callback" * **params** - An associative array of the request's query string parameters. E.g.{"api_signature" => "asdsadsad", "api_timestamp" => "1234567899"} * **body** - The request body as a JSON string. * **api_secret** - Optional. The ShippingEasy API secret for the customer account. Defaults to the global configuration if set.