Create Switch charge (server-side card authorization)
Create Switch charge (server-side card authorization)
Essayer cette requête dans le sandbox
POSThttps://sandbox.api.lomi.africa/charge/switch
Aperçu
Create Switch charge (server-side card authorization)
Authorizes a card from server-supplied credentials and routes it across acquiring rails. May return a redirect URL for 3DS authentication or signal retry_other_rail to fall back to another rail. Requires a PCI-DSS-compliant integration.
Quand l’utiliser
Utilisez lorsque votre intégration est conforme PCI-DSS et soumet les informations de carte côté serveur, plutôt que de collecter les cartes via le checkout hébergé ou Payment Elements.
À savoir
La soumission des informations de carte brutes nécessite une intégration conforme PCI-DSS. Suivez next_action pour la 3DS et retry_other_rail en cas de refus du rail principal.
Voir aussi
Créer un encaissement carte · Encaissements directs
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/switch
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: CreateSwitchChargeDto
| Champ | Obligatoire | Type | Description |
|---|---|---|---|
amount | Oui | number | Amount in XOF francs |
currency_code | Non | enum ("XOF") | - |
pan | Oui | string | - |
expiry | Oui | string | MM/YY or YYMM |
cvv | Oui | string | - |
customer_id | Non | string | - |
customer_email | Non | string | - |
customer_name | Non | string | - |
customer_phone | Non | string | - |
description | Non | string | - |
payment_reference | Non | string | - |
product_id | Non | string | - |
subscription_id | Non | string | - |
checkout_session_id | Non | string | - |
quantity | Non | number | - |
metadata | Non | object | - |
ecom_ip | Non | string | Customer IP for EComIp |
Exemple de corps :
{
"amount": 10000,
"pan": "4221941234569109",
"expiry": "06/25",
"cvv": "123"
}Réponses
| Statut | Description |
|---|---|
201 | Switch 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/switch" \
-H "X-API-KEY: $LOMI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"amount":10000,"pan":"4221941234569109","expiry":"06/25","cvv":"123"}'OpenAPI
- operationId:
ChargesController_createSwitchCharge - Operation:
POST /charge/switch
Schémas complets et Try it : référence API.