Consulter une facture
curl --request POST \
--url https://api-m.dexchange.sn/api/v1/billing/inquiry \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"serviceCode": "SENELEC_SN_BILL",
"reference_client": "210278816"
}
'import requests
url = "https://api-m.dexchange.sn/api/v1/billing/inquiry"
payload = {
"serviceCode": "SENELEC_SN_BILL",
"reference_client": "210278816"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({serviceCode: 'SENELEC_SN_BILL', reference_client: '210278816'})
};
fetch('https://api-m.dexchange.sn/api/v1/billing/inquiry', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-m.dexchange.sn/api/v1/billing/inquiry",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'serviceCode' => 'SENELEC_SN_BILL',
'reference_client' => '210278816'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-m.dexchange.sn/api/v1/billing/inquiry"
payload := strings.NewReader("{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-m.dexchange.sn/api/v1/billing/inquiry")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-m.dexchange.sn/api/v1/billing/inquiry")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"referenceClient": "210278816",
"bills": [
{
"paymentTransactionNumber": "<string>",
"referenceClient": "000210278816",
"referenceFacture": "8000000680",
"nom": "FALL OUSSEYNOU",
"prenom": "<string>",
"montant": 104500,
"frais": 0,
"total": 104500,
"dateEcheance": "2018-12-31",
"paid": false,
"address": "<string>",
"meterStatus": "<string>"
}
]
}{
"message": [
"<string>"
],
"success": true
}{
"message": [
"<string>"
],
"success": true
}Bills & Top-ups
Bill Inquiry
Retrieve bill or meter information before payment
POST
/
api
/
v1
/
billing
/
inquiry
Consulter une facture
curl --request POST \
--url https://api-m.dexchange.sn/api/v1/billing/inquiry \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"serviceCode": "SENELEC_SN_BILL",
"reference_client": "210278816"
}
'import requests
url = "https://api-m.dexchange.sn/api/v1/billing/inquiry"
payload = {
"serviceCode": "SENELEC_SN_BILL",
"reference_client": "210278816"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({serviceCode: 'SENELEC_SN_BILL', reference_client: '210278816'})
};
fetch('https://api-m.dexchange.sn/api/v1/billing/inquiry', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-m.dexchange.sn/api/v1/billing/inquiry",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'serviceCode' => 'SENELEC_SN_BILL',
'reference_client' => '210278816'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-m.dexchange.sn/api/v1/billing/inquiry"
payload := strings.NewReader("{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-m.dexchange.sn/api/v1/billing/inquiry")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-m.dexchange.sn/api/v1/billing/inquiry")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"serviceCode\": \"SENELEC_SN_BILL\",\n \"reference_client\": \"210278816\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"referenceClient": "210278816",
"bills": [
{
"paymentTransactionNumber": "<string>",
"referenceClient": "000210278816",
"referenceFacture": "8000000680",
"nom": "FALL OUSSEYNOU",
"prenom": "<string>",
"montant": 104500,
"frais": 0,
"total": 104500,
"dateEcheance": "2018-12-31",
"paid": false,
"address": "<string>",
"meterStatus": "<string>"
}
]
}{
"message": [
"<string>"
],
"success": true
}{
"message": [
"<string>"
],
"success": true
}Bill Inquiry
Retrieves bill information (amount due) or meter details before a bill payment / top-up.This step is optional but recommended: it lets you display the bill (or meter status) to your user before paying. The payment endpoint performs an internal inquiry anyway.
Endpoint
POST /api/v1/billing/inquiry
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer YOUR_API_KEY |
| Content-Type | string | Yes | application/json |
Request Body
{
"serviceCode": string, // Billing service code
"reference_client": string // Meter number / customer reference
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceCode | string | Yes | Biller code (see table below) |
| reference_client | string | Yes | Meter number / police / customer reference to look up |
Available billing services
| serviceCode | Biller | Type | Amount |
|---|---|---|---|
SENEAU_SN_BILL | SenEau | Water bill (postpaid) | Fixed |
SENELEC_SN_BILL | Senelec | Postpaid electricity bill | Fixed |
WOYOFAL_SN_BILL | Woyofal | Prepaid electricity top-up | Customer-chosen |
Response
Successful Response
{
"success": true,
"referenceClient": "210278816",
"bills": [
{
"paymentTransactionNumber": null,
"referenceClient": "000210278816",
"referenceFacture": "8000000680",
"nom": "FALL OUSSEYNOU",
"prenom": null,
"montant": 104500,
"frais": 0,
"total": 104500,
"dateEcheance": "2018-12-31",
"paid": false,
"address": null,
"meterStatus": null
}
]
}
For Woyofal (prepaid top-up),
bills[0] represents the meter: montant is 0 (the customer chooses the amount at payment), and meterStatus / address / nom describe the meter.bills[] fields
| Field | Type | Description |
|---|---|---|
| referenceClient | string | Meter number |
| referenceFacture | string | Bill reference (SenEau/Senelec) or session token (Woyofal) |
| nom | string | Account holder name (if available) |
| montant | number | Bill amount (0 for customer-chosen top-ups) |
| frais | number | Provider fee (informational) |
| total | number | montant + frais |
| dateEcheance | string | Due date (postpaid bills) |
| paid | boolean | true if the bill is already settled |
| address | string | Meter address (Woyofal) |
| meterStatus | string | Meter status (Woyofal) |
Error Response
{
"success": false,
"message": "No bill found",
"bills": []
}
Error Codes
| HTTP Code | Description |
|---|---|
| 400 | Invalid parameters / bill not found |
| 401 | Invalid API key |
| 403 | API under maintenance |
Request Example
curl -X POST https://api-m.dexchange.sn/api/v1/billing/inquiry \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"serviceCode": "SENELEC_SN_BILL",
"reference_client": "210278816"
}'
Authorizations
Entrez votre clé API comme: Bearer <API_KEY>
Body
application/json
Référence à consulter
⌘I