Aller au contenu principal

Vérifier le Statut

Récupérer les informations détaillées et le statut actuel d'un retrait.

Endpoint

GET /api/withdraws/withdraws/{reference}

Paramètres

ParamètreTypeRequisDescription
referenceStringRéférence unique du retrait (ex. WTD1704067200000ABC123)

Exemple de requête

curl -X GET "https://app.awdpay.com/api/withdraws/withdraws/WTD1704067200000ABC123" \
-H "Authorization: Bearer $AWDPAY_TOKEN"

Réponse

{
"reference": "WTD1704067200000ABC123",
"status": "success",
"amount": 5000.00,
"currency": "XOF",
"beneficiaryName": "Amadou Diallo",
"beneficiaryPhone": "+221770123456",
"beneficiaryEmail": "amadou@example.com",
"country": "SN",
"gatewayName": "wave-senegal",
"createdAt": "2025-01-15T10:30:00Z",
"processedAt": "2025-01-15T10:30:45Z",
"expiresAt": "2025-01-15T11:30:00Z",
"failureReason": null,
"externalReference": "WAVE_TXN_987654",
"description": "Paiement complété avec succès"
}

Champs de réponse

ChampTypeDescription
referenceStringRéférence unique du retrait
statusStringStatut actuel (voir tableau ci-dessous)
amountDoubleMontant du retrait
currencyStringCode devise
beneficiaryNameStringNom du bénéficiaire
beneficiaryPhoneStringNuméro de téléphone
beneficiaryEmailStringEmail du bénéficiaire
countryStringCode pays
gatewayNameStringPasserelle utilisée
createdAtDateTimeDate de création
processedAtDateTimeDate de traitement (si complété)
expiresAtDateTimeDate d'expiration
failureReasonStringRaison de l'échec (si failed)
externalReferenceStringRéférence passerelle externe
descriptionStringDescription du statut

Statuts possibles

StatutDescriptionAction recommandée
pendingRetrait créé, en attente de traitementAttendre ou annuler
processingEn cours de traitement par la passerelleAttendre
success✅ Fonds transférés avec succès au bénéficiaireComplété
failed❌ Transfert échouéVérifier failureReason, réessayer
expired⏰ Retrait expiré avant traitementCréer un nouveau retrait
cancelled🚫 Retrait annuléCréer un nouveau retrait

Diagramme de flux de statut

┌─────────┐
│ pending │
└────┬────┘


┌────────────┐
│ processing │
└─────┬──────┘

├──────────────┬──────────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ success │ │ failed │ │ expired │
└─────────┘ └─────────┘ └─────────┘

Polling recommandé

Stratégie de polling

Pour les passerelles sans webhooks, interrogez le statut avec backoff exponentiel :

  • 1ère tentative : après 5 secondes
  • 2ème tentative : après 15 secondes
  • 3ème tentative : après 30 secondes
  • Puis toutes les minutes pour max 10 minutes
async function pollWithdrawStatus(reference, maxAttempts = 10) {
const delays = [5000, 15000, 30000, 60000, 60000, 60000, 60000, 60000, 60000, 60000];

for (let i = 0; i < maxAttempts; i++) {
const response = await fetch(
`https://app.awdpay.com/api/withdraws/withdraws/${reference}`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);

const data = await response.json();

if (['success', 'failed', 'expired', 'cancelled'].includes(data.status)) {
return data; // État final atteint
}

await new Promise(resolve => setTimeout(resolve, delays[i]));
}

throw new Error('Timeout : statut non résolu');
}

Prochaine étape

➡️ Liste des retraits — Consulter l'historique de vos disbursements