Créer un encaissement carte (client_secret)
Créer un encaissement carte (client_secret)
Aperçu
Créer un encaissement carte (client_secret)
Crée un encaissement carte embarqué et renvoie le client_secret pour votre interface de paiement.
Quand utiliser cet endpoint
Utilisez cet endpoint quand vous devez exécuter POST /charge/card (Créer un encaissement carte (client_secret)).
Authentification
Les routes marchandes nécessitent une clé API dans l’en-tête X-API-KEY (voir Aperçu de l’intégration). Utilisez une clé test avec https://sandbox.api.lomi.africa et une clé live avec https://api.lomi.africa.
Point de terminaison
POST /charge/card
URLs de base :
https://sandbox.api.lomi.africahttps://api.lomi.africa
Requête
Paramètres de chemin
Aucun paramètre de chemin au-delà du motif d’URL.
Paramètres de requête
Aucun paramètre de requête.
Corps de la requête
Charge utile JSON.
Schéma: CreateCardChargeDto
| Champ | Obligatoire | Type | Description |
|---|---|---|---|
amount | Oui | number | Amount to charge in the original currency |
currency_code | Non | enum ("XOF", "USD", "EUR") | Currency code |
currency | Non | enum ("XOF", "USD", "EUR") | Backward-compatible alias for currency_code. Use currency_code in new integrations. |
customer_id | Non | string | Internal customer UUID (v4). Alternative: send customer_email + customer_name to create/find a customer. |
customer_email | Non | string | Customer email — required together with customer_name when customer_id is omitted. |
customer_name | Non | string | Customer display name — required together with customer_email when customer_id is omitted. |
customer_phone | Non | string | Customer phone number |
description | Non | string | Description shown in payment providers and logs |
payment_reference | Non | string | Reference included in metadata for reconciliation |
product_id | Non | string | Optional product UUID for metadata and reconciliation |
subscription_id | Non | string | Optional subscription UUID for metadata and reconciliation |
quantity | Non | number | Optional quantity for internal reconciliation |
metadata | Non | object | Custom metadata merged into provider metadata |
appearance_theme | Non | enum ("light", "dark", "flat") | Optional Payment Element theme for client-side card UI: light, dark, or flat. |
appearance_border_radius | Non | number | Optional Payment Element border radius (px) returned for client-side rendering. |
appearance_billing_address | Non | enum ("auto", "never") | Optional Payment Element billing address collection mode. Use never to hide country/address selector in Payment Element UI. |
Exemple de corps :
{
"amount": 10000
}Réponses
| Statut | Description |
|---|---|
201 | Encaissement carte créé |
Schéma de réponse : CardChargeResponseDto — success et data avec client_secret, id (ex. pi_…), montants, status, et appearance optionnel pour l’UI Payment Element.
Erreurs
Les erreurs suivent le format JSON standard (code de statut et message lisible par machine). Validez les entrées avant appel ; 401 indique une clé manquante/invalide, 404 une ressource introuvable pour cette organisation, 429 une limitation de débit. Pour les retries sûrs sur les créations, envoyez une clé d’idempotence quand votre flux le permet.
Exemple
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/card" \
-H "X-API-KEY: $LOMI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount":10000}'OpenAPI
- operationId:
ChargesController_createCardCharge - Operation:
POST /charge/card
Schémas complets et Try it : référence API. Contrat machine : openapi.json à la racine des docs.