Create Switch charge
Create Switch charge
Overview
Create Switch charge
Authorizes a card from server-supplied credentials and routes it across acquiring rails. May return a 3DS redirect URL or signal retry_other_rail to fall back to another rail.
When to use this
Use when your integration is PCI-DSS compliant and submits card credentials server-side, rather than collecting cards through hosted checkout or embedded Payment Elements.
Good to know
Submitting raw card credentials requires a PCI-DSS-compliant integration. Follow next_action for 3DS redirects and retry_other_rail when the primary rail declines.
See also
Create card charge · Direct charges
Authentication
Merchant routes require an API key in the X-API-KEY header (see Integration overview). Use a test key against https://sandbox.api.lomi.africa and a live key against https://api.lomi.africa.
Endpoint
POST /charge/switch
Base URLs:
https://sandbox.api.lomi.africahttps://api.lomi.africa
Request
Path parameters
No path parameters beyond the URL pattern.
Query parameters
No query parameters.
Headers
| Name | In | Required | Schema | Description |
|---|---|---|---|---|
Lomi-Account | header | No | - | Optional lomi. Network account id (acct_...). When present, the API key acts as the Operator and the request targets the connected Member Account. |
Request body
JSON request payload.
Schema: CreateSwitchChargeDto
| Field | Required | Type | Description |
|---|---|---|---|
amount | Yes | number | Amount in XOF francs |
currency_code | No | enum ("XOF") | - |
pan | Yes | string | - |
expiry | Yes | string | MM/YY or YYMM |
cvv | Yes | string | - |
customer_id | No | string | - |
customer_email | No | string | - |
customer_name | No | string | - |
customer_phone | No | string | - |
description | No | string | - |
payment_reference | No | string | - |
product_id | No | string | - |
subscription_id | No | string | - |
checkout_session_id | No | string | - |
quantity | No | number | - |
metadata | No | object | - |
ecom_ip | No | string | Customer IP for EComIp |
Example body:
{
"amount": 10000,
"pan": "4221941234569109",
"expiry": "06/25",
"cvv": "123"
}Responses
| Status | Description |
|---|---|
201 | Switch charge created |
Errors
Errors follow the standard JSON error format (status code and machine-readable message). Validate inputs before calling; 401 indicates a missing/invalid key, 404 a missing resource for this organization, 429 rate limiting. For safe retries on create-style calls, send an idempotency key when your flow supports it.
Example
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
Full schemas and Try it: API reference. Machine-readable contract: repo apps/docs/openapi.json.