{"_id":"5ab3073f4eb086002602b233","project":"544fc17e698ab40800b4f891","version":{"_id":"56326e9cdf556c0d00cd08ca","project":"544fc17e698ab40800b4f891","__v":22,"createdAt":"2015-10-29T19:08:12.724Z","releaseDate":"2015-10-29T19:08:12.724Z","categories":["56326e9ddf556c0d00cd08cb","56326e9ddf556c0d00cd08cc","56326e9ddf556c0d00cd08cd","56326e9ddf556c0d00cd08ce","56326e9ddf556c0d00cd08cf","56326e9ddf556c0d00cd08d0","56326e9ddf556c0d00cd08d1","56326e9ddf556c0d00cd08d2","56326e9ddf556c0d00cd08d3","56326e9ddf556c0d00cd08d4","56d942ac337fd11300d6a251","5ab2fcf66a1d77001230b47e","5afc2943bd2ef4000330bca7","5d1d87419a969a00141c6b4c","5d1d8948ef26b2002c6468d1","5d1d8afe7b2b24005bec7de0","5d1d8b24f5cfcb00201490bb","5d1d8bb82d46d1004a02581f","5d1d8de1e4edb0019ed63acd","5d1d8f6b613fb90050d0d3e0","5d1d934ed377870191039d28","5d1d99810b2e4600500eb5ff","5d1da14e613fb90050d0d491","5d229a846cf323005a7fa998","5d229a8c8abf65001cc4768d","5d229a9494b856002e26b6e1","5d229a9bf77bb900507ccb04","5d229aa88abf65001cc4768e","5d24310a9ca8c80054786177","5d24359101cc3a00508e7482","5d24418fa791b20050733b32"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"collector","version_clean":"2.1.0","version":"2.1"},"category":{"_id":"5ab2fcf66a1d77001230b47e","project":"544fc17e698ab40800b4f891","version":"56326e9cdf556c0d00cd08ca","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-03-22T00:46:46.951Z","from_sync":false,"order":4,"slug":"webhooks","title":"Webhooks"},"user":"544fc065698ab40800b4f888","githubsync":"","__v":0,"parentDoc":null,"updatedAt":"2019-07-04T07:56:23.203Z","updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-03-22T01:30:39.283Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"title\": \"Getting Started\"\n}\n[/block]\nTo support coins.ph webhooks, 3rd party service needs to implement endpoint for receiving HTTPS requests and provide URL of this endpoint to coins. You may want to use webhooks to receive real-time notifications about status of your orders, although, in case of bad connectivity of your service delivery of the notification is not guaranteed.\n[block:api-header]\n{\n  \"title\": \"Authentication\"\n}\n[/block]\nEach request contains HTTP header with authentication token, endpoint should not accept requests without token.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"payload = {\\n  'event': {\\n    'name': 'sell_order.released',\\n    'data': {}\\n  }\\n}\\n\\nheaders = {\\n  'Authorization': 'Token {TOKEN_ASSIGNED_TO_URL}'\\n}\\n\\nurl = https://your_domain_name/path\\n\\nresponse = requests.post(\\n  url,\\n  json=payload,\\n  headers=headers,\\n  timeout=timeout,\\n)\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Supported types of webhooks\"\n}\n[/block]\nType of webhook is specified in payload, *event.name* key.\n\n* sell_order.released\n* sell_order.refunded\n* sell_order.expired\n* sell_order.delivered\n* wallet.balance_up\n[block:api-header]\n{\n  \"title\": \"Format of webhook payload\"\n}\n[/block]\nEach request contains event.name and event.data, generally exact format of data depends on type of event, which can be detected by event.name.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"payload = {\\n  'event': {\\n    'name': 'sell_order.released',\\n    'data': {\\n      'id': 'sell_order_id',\\n      'currency_amount': '100.00',\\n      'currency': 'PHP',\\n      ...\\n    }\\n  }\\n}\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"sell_order.* main fields\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  'event': {\\n    'name': 'sell_order.released',\\n    'data': {\\n      'id': 'sell_order_id',\\n      'amount': '100.00',\\n      'currency': 'PHP',\\n      'user_id': 'user_id',\\n      ...\\n    }\\n  }\\n}\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"webhooks","type":"basic","title":"How to set up web-hook notifications"}

How to set up web-hook notifications


[block:api-header] { "title": "Getting Started" } [/block] To support coins.ph webhooks, 3rd party service needs to implement endpoint for receiving HTTPS requests and provide URL of this endpoint to coins. You may want to use webhooks to receive real-time notifications about status of your orders, although, in case of bad connectivity of your service delivery of the notification is not guaranteed. [block:api-header] { "title": "Authentication" } [/block] Each request contains HTTP header with authentication token, endpoint should not accept requests without token. [block:code] { "codes": [ { "code": "payload = {\n 'event': {\n 'name': 'sell_order.released',\n 'data': {}\n }\n}\n\nheaders = {\n 'Authorization': 'Token {TOKEN_ASSIGNED_TO_URL}'\n}\n\nurl = https://your_domain_name/path\n\nresponse = requests.post(\n url,\n json=payload,\n headers=headers,\n timeout=timeout,\n)", "language": "python" } ] } [/block] [block:api-header] { "title": "Supported types of webhooks" } [/block] Type of webhook is specified in payload, *event.name* key. * sell_order.released * sell_order.refunded * sell_order.expired * sell_order.delivered * wallet.balance_up [block:api-header] { "title": "Format of webhook payload" } [/block] Each request contains event.name and event.data, generally exact format of data depends on type of event, which can be detected by event.name. [block:code] { "codes": [ { "code": "payload = {\n 'event': {\n 'name': 'sell_order.released',\n 'data': {\n 'id': 'sell_order_id',\n 'currency_amount': '100.00',\n 'currency': 'PHP',\n ...\n }\n }\n}", "language": "python" } ] } [/block] [block:api-header] { "title": "sell_order.* main fields" } [/block] [block:code] { "codes": [ { "code": "{\n 'event': {\n 'name': 'sell_order.released',\n 'data': {\n 'id': 'sell_order_id',\n 'amount': '100.00',\n 'currency': 'PHP',\n 'user_id': 'user_id',\n ...\n }\n }\n}", "language": "python" } ] } [/block]