{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"3c2f7048-3c6c-4bc0-9e71-c05bf95eb6d0","name":"BP API (B2B)","description":"An API to a web-service for online electricity vending system.\n\n## Getting Started\n\nAll requests and responses are have a content type of `application/json` (Any other response type should not be considered.) Any language with an http client can be used to make request to the service.\n\n## Making Requests\n\nAll requests are authenticated using an API key injected into the `Authorization` header as a Bearer Token.\n\nAs an extra layer of security, responses contain an `x-buypower-signature` header which is an SHA512 Hash of the response body + your API Key. You may use this to know if the response was sent by BuyPower.\n\n## Handling Responses\n\nThe API throws errors when responses to requests do not come as they should. Just like successful transactions, error responses have a fixed format. This allows you to understand the meaning certain responses and handle/interpret them as they occur.\n\n### Responses\n\nOn a happy path, responses are formatted as follows.\n\n``` json\n{\n    \"status\": true,\n    \"message\": \"A happy message\",\n    \"responseCode\": 200,\n    \"data\": {...}\n}\n\n ```\n\nOn a not so happy path, below is a typical format of an error response.\n\n``` json\n{\n    \"status\": false,\n    \"message\": \"A not so happy message\",\n    \"responseCode\": 400,\n}\n\n ```\n\nLet's describe these attributes for clarity.\n\n| **Attribute** | **Type** | **Description** | **Optional** |\n| --- | --- | --- | --- |\n| status | boolean | This is the status of the request used to tell if the request was successful or not. | No |\n| error | boolean | A flag to signify if an error occurred in processing the request.  <br>  <br>_**Please note that this has been deprecated. Use the status attribute instead.**_ | Yes |\n| message | string | A human readable description of the error that occurred. | No |\n| responseCode | number | A machine readable categorisation of the response received. | No |\n| delay | array | This represents the delay required to retry/re-query a certain transaction. This attribute is associated with responses that do not give an absolute answer to the state of the transaction. | Yes |\n| data | object | This the consumable data sent as a successful response to your request.  <br>  <br>This is only present when your request comes back successfully. | Yes |\n\n> The different responses applicable to an endpoint can be found amongst the examples given in this document. Please note that any response received that does not follow this format **should not** be considered as a failed response. A re-query maybe issued to get the true state of the request in such cases. \n  \n\n##### Response Codes\n\nResponse codes (i.e. the values applicable to the `responseCode` attribute in responses) allow you to interpret the categories of responses that you may receive in production. They are closely related to the standard [HTTP Status Codes](https://). Below are the codes you may encounter and their descriptions.\n\n| **Code** | **Category** | **Description** | **Treatment** |\n| --- | --- | --- | --- |\n| 200 | Successful | This signifies that the request has been fulfilled | Treat as successful |\n| 202 | Accepted | This is returned when we have received your request but there isn't a response yet.  <br>  <br>You are expected to make a re-query when this occurs. Please allow at least 2 minutes before making a re-query. | Re-query after 2 minutes using the same order reference.  <br>  <br>Treat as pending |\n| 400 | Validation Error | Inputs passed during request may not be as specified.  <br>  <br>You are expected to re-validate inputs before trying again. | Modify input sent during the request and try again.  <br>  <br>Treat as failed |\n| 422 | Unprocessable | The request is valid but for some other reasons, the request can not be fulfilled. Example may include, insufficient wallet balance. | Try again later.  <br>  <br>Treat as failed |\n| 409 | Conflict | The request may not have been sent properly. An example is when a request has been sent more than once. | Re-query using the same order reference.  <br>  <br>Treat as failed |\n| 500 | Server Error | This is a generic error which means the server can not process the request at the time it was made. | Re-query with the same order reference to get the final status before retrying.  <br>  <br>Treat as pending |\n| 501 | Not Implemented | This error signifies that the request can not be fulfilled.  <br>  <br>An example may include a Service Provider rejecting a request to purchase a token because the meter has not been activated on their system. | Try again later.  <br>  <br>Treat as failed. |\n| 502 | Unexpected Error | This error reflects when we receive an unexpected response from the provider.  <br>  <br>This should be treated as a pending transaction and should be requeried to resolve the transaction \\[which could end up as failure or success\\]. | Re-query for the final status of the order after 2 minutes  <br>  <br>Treat as pending |\n| 503 | Service Not Available | This is a temporary error that may occur when we cannot fulfil the request. This usually does not last as long. It may clear out within a few minutes | Re-query with the same order reference to get the final status before retrying.  <br>  <br>Treat as pending. |\n\n> Please note that any response received that does not follow this format should not be considered as a failed response. A re-query maybe issued to get the true state of the request in such cases. \n  \n\n## Sample Meters\n\nBelow are sample meters to simulate scenarios you may encounter during production. This will allow you to handle them programmatically before setting into production.\n\n| **Meter Number** | **Scenario** |\n| --- | --- |\n| MeterNo - 12345678910  <br>DSTV - 8093245829  <br>GOTV - 7036378354  <br>STARTIMES - 7036378354 | Successful Transaction |\n| 00000000000 | Service Not Available Error |\n| 00000000010 | Duplicate Transaction Error |\n| 00000000020 | Pending Transaction Error |\n| 00000000030 | Minimum Vend Amount Error |\n| 00000000040 | Account Under Maintenance Error |\n| 00000000050 | Account Under Activation Error |\n| 00000000060 | Account Under Migration Error |\n| 00000000070 | Duplicate Request Error |\n| 00000000080 | Foreign Pending Transaction Error |\n| 00000000090 | Transaction Period Limit Error |\n| 00000000100 | Unexpected Response Error |","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"10424279","team":720607,"collectionId":"3c2f7048-3c6c-4bc0-9e71-c05bf95eb6d0","publishedId":"TzY7eZbx","public":true,"publicUrl":"https://docs.buypower.ng","privateUrl":"https://go.postman.co/documentation/10424279-3c2f7048-3c6c-4bc0-9e71-c05bf95eb6d0","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"A5B558"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":"An API documentation of the BuyPower B2B channel"},{"name":"title","value":"BuyPower API Documentation"}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"A5B558"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"A5B558"}}]}},"version":"8.10.1","publishDate":"2024-08-19T09:51:52.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"BuyPower API Documentation","description":"An API documentation of the BuyPower B2B channel"},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[{"name":"BP APIX","id":"7e6ed636-c1c4-4df5-8e3a-1101a47ee1f9","owner":"10424279","values":[{"key":"token","value":"7883e2ec127225f478279f0cb848e3551eaaa99d484ec39cf0b77a9ccf1d9d0d","enabled":false},{"key":"token","value":"7883e2ec127225f478279f0cb848e3551eaaa99d484ec39cf0b77a9ccf1d9d0d","enabled":true},{"key":"paidOn","value":"","enabled":true},{"key":"user_phone","value":"00000000000","enabled":true},{"key":"user_password","value":"00000000000","enabled":true},{"key":"apiToken","value":"","enabled":false},{"key":"hash","value":"","enabled":true},{"key":"meterNo","value":"12000010001","enabled":true},{"key":"discoName","value":"ABUJA","enabled":true},{"key":"vendType","value":"PREPAID","enabled":true},{"key":"currentOrderId","value":"","enabled":true},{"key":"chargeAction","value":"","enabled":true},{"key":"amountDue","value":"","enabled":true},{"key":"selectedMethod","value":"","enabled":true,"type":"any"},{"key":"orderId","value":"","enabled":true,"type":"default"},{"key":"disco","value":"ABUJA","enabled":true,"type":"default"},{"key":"host","value":"https://idev.buypower.ng","enabled":true,"type":"default"},{"key":"myUUID","value":"","enabled":true,"type":"any"}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/8c42c1195df8527b4d3994b28deaf6aefafc249a4a84265b75d26bfcecd3190f","favicon":"https://buypower.ng/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"BP APIX","value":"10424279-7e6ed636-c1c4-4df5-8e3a-1101a47ee1f9"}],"canonicalUrl":"https://docs.buypower.ng/view/metadata/TzY7eZbx"}