Aller au contenu principal

Créer un Retrait

Initier un disbursement vers le portefeuille mobile d'un bénéficiaire.

Endpoint

POST /api/withdraws/initiate

Paramètres de requête

ParamètreTypeRequisDescription
amountDoubleMontant à transférer (min : 0.01)
currencyStringCode devise ISO 4217 (3 caractères, ex. XOF, EUR)
beneficiaryNameStringNom complet du bénéficiaire
beneficiaryPhoneStringNuméro de téléphone au format international (ex. +221770000000)
beneficiaryEmailStringEmail du bénéficiaire
countryStringCode pays ISO 3166-1 alpha-2 (ex. SN, CI)
gatewayNameStringPasserelle spécifique (sinon sélection automatique)
callbackUrlStringURL webhook pour notifications (max 500 caractères)
returnUrlStringURL de redirection après traitement
metadataMap<String, String>Données personnalisées (ex. orderReference, userId)

Exemple de requête

curl -X POST "https://app.awdpay.com/api/withdraws/initiate" \
-H "Authorization: Bearer $AWDPAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "XOF",
"beneficiaryName": "Amadou Diallo",
"beneficiaryPhone": "+221770123456",
"beneficiaryEmail": "amadou@example.com",
"country": "SN",
"gatewayName": "wave-senegal",
"callbackUrl": "https://merchant.example/webhooks/withdrawals",
"metadata": {
"orderReference": "PAYOUT-8831",
"userId": "usr_12345"
}
}'

Réponse succès

{
"reference": "WTD1704067200000ABC123",
"status": "pending",
"fees": 50.0,
"paymentType": "direct",
"createdAt": "2025-01-15T10:30:00Z",
"expiresAt": "2025-01-15T11:30:00Z",
"message": "Retrait initié avec succès"
}

Champs de réponse

ChampTypeDescription
referenceStringRéférence unique du retrait (format : WTD{timestamp}{random})
statusStringStatut initial (pending, processing)
feesDoubleMontant des frais facturés
paymentTypeStringType de traitement (direct, redirect, redirect_post, ussd)
createdAtDateTimeDate/heure de création
expiresAtDateTimeDate/heure d'expiration
messageStringMessage descriptif
urlStringURL de confirmation (si paymentType = redirect)

Codes d'erreur

Code HTTPCode erreurDescription
400invalid_requestParamètres manquants ou invalides
401unauthorizedToken invalide ou expiré
404merchant_not_foundCompte marchand non trouvé
422insufficient_balanceSolde marchand insuffisant
422limit_exceededLimite de transaction dépassée
500server_errorErreur interne

Prochaine étape

➡️ Vérifier le statut — Suivre le statut de votre retrait