Sandbox de paiement
Cette application simule un prestataire de paiement pour les environnements de developpement. Base URL: http://pay.afrohoop.com
{
"username": "demo",
"password": "1TFzh8<3KJQr",
"client_id": "cashpay",
"client_secret": "HpuNOm3sDOkAvd8v3UCIxiBu68634BBs"
}
POST /auth pour obtenir un bearer token.POST /orders avec le token pour creer une commande.bill_url pour simuler le paiement.GET /orders/:bill_ref/status.POST /auth
Retourne un JWT d'acces valable 1 heure.
POST /orders
Cree une commande. Champs requis: amount, merchant_reference et client.phone.
GET /bill/:order_id
Affiche la page de simulation de paiement.
POST /process-payment/:order_id
Route interne utilisee par le formulaire pour finaliser en succes ou echec.
GET /orders/:bill_ref/status
Retourne le statut d'une commande via order_id ou order_reference.
GET /admin
Tableau de bord local pour visualiser les commandes et rejouer les callbacks.
Payload minimal recommande pour POST /orders.
{
"amount": 1500,
"merchant_reference": "CMD-2026-0001",
"client": {
"phone": "22890000000"
},
"description": "Paiement de test sandbox",
"type_notif": ["sms", "whatsapp"],
"currency": "XOF",
"callback_url": "https://mon-app.local/api/payment/callback",
"redirect_url": "https://mon-app.local/payment/return"
}
Reponse typique renvoyee par POST /orders.
{
"amount": 1500,
"merchant_reference": "CMD-2026-0001",
"client": {
"phone": "22890000000"
},
"type_notif": ["sms", "whatsapp"],
"callback_url": "https://mon-app.local/api/payment/callback",
"description": "Paiement de test sandbox",
"redirect_url": "https://mon-app.local/payment/return",
"order_id": "482193756",
"bill_url": "http://pay.afrohoop.com/bill/482193756",
"date_created": "2026-05-14T12:00:00.000Z",
"date_updated": "2026-05-14T12:00:00.000Z",
"state": "Pending",
"order_reference": "SANDBOX-482193756",
"currency": "XOF",
"type_notif": ["sms", "whatsapp"],
"payments": []
}
Reponse possible de GET /orders/:bill_ref/status apres un
paiement reussi.
{
"state": "Paid",
"order_reference": "SANDBOX-482193756",
"merchant_reference": "CMD-2026-0001",
"amount": 1500,
"currency": "XOF",
"billed_amount": 1500,
"received_amount": 1500,
"bill_url": "http://pay.afrohoop.com/bill/482193756",
"date_update": "2026-05-14T12:03:00.000Z",
"date_expiration": "2026-05-19T12:00:00.000Z",
"client": {
"phone": "22890000000"
},
"code_paiement": "649620",
"date_create": "2026-05-14T12:00:00.000Z",
"payments": [
{
"id": 483920,
"amount": 1500,
"thirdparty_reference": 991245,
"payment_date": "2026-05-14T12:03:00.000Z",
"gateway": {
"libelle": "MYMOCK-GATEWAY",
"methode": ""
}
}
]
}
Si callback_url est fourni, Paymock envoie un
POST JSON avec un token JWT signe avec
client_secret.
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Le contenu decode du token ressemble a ceci:
{
"state": "Paid",
"order_reference": "SANDBOX-482193756",
"merchant_reference": "CMD-2026-0001",
"amount": 1500,
"currency": "XOF",
"billed_amount": 1500,
"received_amount": 1500,
"bill_url": "http://pay.afrohoop.com/bill/482193756",
"date_update": "2026-05-14T12:03:00.000Z",
"date_expiration": "2026-05-19T12:00:00.000Z",
"client": {
"phone": "22890000000"
},
"code_paiement": "649620",
"date_create": "2026-05-14T12:00:00.000Z",
"payments": [
{
"id": 483920,
"amount": 1500,
"thirdparty_reference": 991245,
"payment_date": "2026-05-14T12:03:00.000Z",
"gateway": {
"libelle": "MYMOCK-GATEWAY",
"methode": ""
}
}
]
}
200 reponse standard de succes pour auth et lecture de statut.
201 commande creee avec succes.
400 payload invalide, par exemple amount manquant ou negatif.
401 credentials ou bearer token invalides.
404 commande introuvable.
En cas de paiement reussi, le redirect ajoute cashpay_state=1.
En cas d'echec, le redirect ajoute cashpay_state=0.
curl -X POST http://pay.afrohoop.com/auth \
-H "Content-Type: application/json" \
-d '{
"username": "demo",
"password": "1TFzh8<3KJQr",
"client_id": "cashpay",
"client_secret": "HpuNOm3sDOkAvd8v3UCIxiBu68634BBs"
}'
curl -X POST http://pay.afrohoop.com/orders \
-H "Authorization: Bearer VOTRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 1500,
"merchant_reference": "CMD-2026-0001",
"client": {
"phone": "22890000000"
},
"description": "Paiement de test sandbox",
"type_notif": ["sms", "whatsapp"],
"currency": "XOF",
"callback_url": "https://mon-app.local/api/payment/callback",
"redirect_url": "https://mon-app.local/payment/return"
}'