Aller au contenu principal

Statistiques de Retrait

Obtenez des métriques agrégées sur vos disbursements pour suivre vos performances.

Endpoint​

GET /api/v4/withdraw/statistics

Paramètres de requête​

ParamètreTypeRequisDescription
startDateString❌Date de début (format : yyyy-MM-dd)
endDateString❌Date de fin (format : yyyy-MM-dd)
Période par défaut

Si aucune date n'est spécifiée, les statistiques couvrent tous les retraits de votre compte.

Exemples de requête​

Statistiques globales​

curl -X GET "https://pay.awdpay.pro/api/v4/withdraw/statistics" \
-H "Authorization: Bearer $AWDPAY_TOKEN"

Statistiques du mois en cours​

curl -X GET "https://pay.awdpay.pro/api/v4/withdraw/statistics?startDate=2025-01-01&endDate=2025-01-31" \
-H "Authorization: Bearer $AWDPAY_TOKEN"

7 derniers jours​

curl -X GET "https://pay.awdpay.pro/api/v4/withdraw/statistics?startDate=2025-01-08&endDate=2025-01-15" \
-H "Authorization: Bearer $AWDPAY_TOKEN"

Réponse​

{
"totalWithdrawals": 248,
"successfulWithdrawals": 231,
"failedWithdrawals": 12,
"pendingWithdrawals": 5,
"totalAmount": 12450000.00,
"successAmount": 11800000.00,
"failedAmount": 450000.00,
"pendingAmount": 200000.00,
"totalFees": 187500.00,
"currency": "XOF",
"successRate": 93.15,
"averageAmount": 50201.61,
"largestWithdrawal": 500000.00,
"smallestWithdrawal": 1000.00,
"byGateway": [
{
"gatewayName": "wave-senegal",
"count": 145,
"totalAmount": 7250000.00,
"successCount": 142,
"failedCount": 3
},
{
"gatewayName": "orange-money-sn",
"count": 103,
"totalAmount": 5200000.00,
"successCount": 89,
"failedCount": 9
}
],
"byCountry": [
{
"country": "SN",
"count": 210,
"totalAmount": 10500000.00
},
{
"country": "CI",
"count": 38,
"totalAmount": 1950000.00
}
]
}

Champs de réponse​

Métriques globales​

ChampTypeDescription
totalWithdrawalsIntegerNombre total de retraits
successfulWithdrawalsIntegerNombre de retraits réussis
failedWithdrawalsIntegerNombre de retraits échoués
pendingWithdrawalsIntegerNombre de retraits en attente
totalAmountDoubleMontant total de tous les retraits
successAmountDoubleMontant total des retraits réussis
failedAmountDoubleMontant total des retraits échoués
pendingAmountDoubleMontant total des retraits en attente
totalFeesDoubleTotal des frais facturés
currencyStringDevise principale
successRateDoubleTaux de succès (%)
averageAmountDoubleMontant moyen de retrait
largestWithdrawalDoublePlus grand retrait
smallestWithdrawalDoublePlus petit retrait

Répartition par passerelle​

ChampTypeDescription
gatewayNameStringNom de la passerelle
countIntegerNombre de retraits
totalAmountDoubleMontant total
successCountIntegerNombre de retraits réussis
failedCountIntegerNombre de retraits échoués

Répartition par pays​

ChampTypeDescription
countryStringCode pays
countIntegerNombre de retraits
totalAmountDoubleMontant total

Exemple d'utilisation​

async function getMonthlyReport(year, month) {
const startDate = `${year}-${month.toString().padStart(2, '0')}-01`;
const lastDay = new Date(year, month, 0).getDate();
const endDate = `${year}-${month.toString().padStart(2, '0')}-${lastDay}`;

const response = await fetch(
`https://pay.awdpay.pro/api/v4/withdraw/statistics?startDate=${startDate}&endDate=${endDate}`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);

const stats = await response.json();

console.log(`Rapport du mois ${month}/${year}`);
console.log(`Total : ${stats.totalWithdrawals} retraits`);
console.log(`Taux de succès : ${stats.successRate.toFixed(2)}%`);
console.log(`Montant total : ${stats.totalAmount.toLocaleString()} ${stats.currency}`);
console.log(`Frais totaux : ${stats.totalFees.toLocaleString()} ${stats.currency}`);

return stats;
}

Prochaine étape​

➡️ Webhooks — Recevoir des notifications en temps réel