Create card charge (client_secret)
Create card charge (client_secret)
Aperçu
Create card charge (client_secret)
Creates an embedded card charge and returns the client_secret for your payment UI.
Quand l’utiliser
Utilisez pour la saisie carte dans votre application lorsque vous gérez l’UI produit et la tokenisation.
À savoir
Ne journalisez ni n’exposez client_secret publiquement ; traitez-le comme une capacité courte durée pour le SDK client.
Voir aussi
Créer une session checkout si vous préférez l’encaissement hébergé.
Authentification
Les routes marchandes nécessitent une clé API dans l’en-tête X-API-KEY (voir Vue d’ensemble). Utilisez une clé test avec https://sandbox.api.lomi.africa et une clé live avec https://api.lomi.africa.
Endpoint
POST /charge/card
URLs de base :
https://sandbox.api.lomi.africahttps://api.lomi.africa
Requête
Paramètres d’URL
Pas d’autre paramètre dans l’URL.
Paramètres de requête
Aucun paramètre de requête.
En-têtes
| Nom | Emplacement | Obligatoire | Schéma | Description |
|---|---|---|---|---|
Lomi-Account | header | Non | - | Optional lomi. Network account id (acct_...). When present, the API key acts as the Operator and the request targets the connected Member Account. |
Corps de la requête
Corps 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 | Card charge created |
Erreurs
Les erreurs suivent un format JSON standard. 401 : clé manquante ou invalide. 404 : ressource introuvable. 429 : trop de requêtes. Pour les créations, envoyez une clé d’idempotence si votre flux le permet.
Exemple
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/card" \
-H "X-API-KEY: $LOMI_SECRET_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.