Documentation Index
Fetch the complete documentation index at: https://docs.yabetoopay.com/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
POST https://buy.api.yabetoopay.com/v1/sessions
Authentification
Utilisez votre clé secrète dans l’en-tête Authorization :
Authorization: Bearer YOUR_SECRET_KEY
Corps de la requête
| Paramètre | Type | Obligatoire | Description |
|---|
total | number | Oui | Montant total dans la plus petite unité de devise (ex: 200000 = 200 000 XAF) |
currency | string | Oui | Code devise (ex: xaf, xof) |
accountId | string | Oui | Votre ID de compte Yabetoo |
successUrl | string | Oui | URL de redirection après un paiement réussi |
cancelUrl | string | Oui | URL de redirection en cas d’annulation |
items | array | Non | Liste des articles achetés |
metadata | object | Non | Données personnalisées pour votre référence |
Structure d’un item
{
"productId": "prod_12345",
"productName": "Écran HD",
"quantity": 1,
"price": 200000
}
Exemple de requête
curl -X POST https://buy.api.yabetoopay.com/v1/sessions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-d '{
"total": 200000,
"currency": "xaf",
"accountId": "acct_xxxxxxxx",
"successUrl": "https://votre-site.com/checkout-success",
"cancelUrl": "https://votre-site.com/checkout-cancel",
"metadata": { "orderId": "1234" },
"items": [
{
"productId": "prod_12345",
"quantity": 1,
"price": 200000,
"productName": "Écran HD"
}
]
}'
Réponse
200 OK
{
"accountId": "acct_iNXIGeot1lqyhGI5eP7KL0LcWTCTgFLytfRa",
"successUrl": "https://votre-site.com/checkout-success",
"cancelUrl": "https://votre-site.com/checkout-cancel",
"orderId": "ord_KowaIWyMlD25Lhb8MyY3GQyvN8nFaxTZ7ji7",
"expiresAt": "2024-05-28T13:33:51.760+00:00",
"id": "session_ajrw3pQUUZD8UI2eFkWyUgLxJ4kGuXCoaQeb",
"createdAt": "2024-05-28T12:33:51.762+00:00",
"updatedAt": "2024-05-28T12:33:51.762+00:00"
}
400 Bad Request
{
"errors": [
{
"rule": "required",
"field": "currency",
"message": "required validation failed"
}
]
}
401 Unauthorized
{
"message": "Unauthorized"
}