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
}Factures & Recharges
Consulter une facture
Récupérer les informations d’une facture ou d’un compteur avant paiement
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
}Consulter une facture
Récupère les informations d’une facture (montant dû) ou d’un compteur avant un paiement de facture / une recharge.Cette étape est optionnelle mais recommandée : elle permet d’afficher la facture (ou le statut du compteur) à votre utilisateur avant de payer. L’endpoint de paiement refait de toute façon une consultation interne.
Endpoint
POST /api/v1/billing/inquiry
Headers
| Nom | Type | Requis | Description |
|---|---|---|---|
| Authorization | string | Oui | Bearer YOUR_API_KEY |
| Content-Type | string | Oui | application/json |
Corps de la Requête
{
"serviceCode": string, // Code du service de facturation
"reference_client": string // Numéro de compteur / référence client
}
Paramètres
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| serviceCode | string | Oui | Code du biller (voir tableau ci-dessous) |
| reference_client | string | Oui | Numéro de compteur / police / référence client à consulter |
Services de facturation disponibles
| serviceCode | Biller | Type | Montant |
|---|---|---|---|
SENEAU_SN_BILL | SenEau | Facture eau (postpayée) | Imposé |
SENELEC_SN_BILL | Senelec | Facture électricité postpayée | Imposé |
WOYOFAL_SN_BILL | Woyofal | Recharge électricité prépayée | Choisi (libre) |
Réponse
Réponse Réussie
{
"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
}
]
}
Pour Woyofal (recharge prépayée),
bills[0] représente le compteur : montant vaut 0 (le client choisit le montant au paiement), et meterStatus / address / nom décrivent le compteur.Champs de bills[]
| Champ | Type | Description |
|---|---|---|
| referenceClient | string | Numéro de compteur |
| referenceFacture | string | Référence facture (SenEau/Senelec) ou jeton de session (Woyofal) |
| nom | string | Nom du titulaire (si disponible) |
| montant | number | Montant de la facture (0 pour les recharges à montant libre) |
| frais | number | Frais provider (à titre indicatif) |
| total | number | montant + frais |
| dateEcheance | string | Date d’échéance (factures postpayées) |
| paid | boolean | true si la facture est déjà réglée |
| address | string | Adresse du compteur (Woyofal) |
| meterStatus | string | Statut du compteur (Woyofal) |
Réponse d’Erreur
{
"success": false,
"message": "No bill found",
"bills": []
}
Codes d’Erreur
| Code HTTP | Description |
|---|---|
| 400 | Paramètres invalides / facture introuvable |
| 401 | Clé API invalide |
| 403 | API en maintenance |
Exemple de Requête
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