The essentials to create and confirm your first payment through the Txenka API. A full reference is on the way — meanwhile, this covers the main flow.
The Txenka API is built around payment_intents — every payment you create and confirm. All requests and responses use JSON, and the base URL is https://api.txenka.com/v1.
Every authenticated call uses your API key in the Authorization header. Find your key under Settings → API Keys in the dashboard — use txk_test_… to test without processing real money, and txk_live_… in production.
Authorization: Bearer txk_test_8f2a3c9d1e...A payment_intent represents a charge. Amounts are always in cents (2450 = 24.50 MZN).
curl -X POST https://api.txenka.com/v1/payment-intents \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"amount": 2450,
"currency": "MZN",
"payment_method": "mpesa",
"customer_phone": "258840000000",
"description": "Pedido #1042"
}'{
"object": "payment_intent",
"id": "pi_01hx4k9…",
"status": "requires_confirmation",
"amount": 2450,
"currency": "MZN",
"payment_method": "mpesa"
}Confirming triggers the request with the chosen method — for example, an STK push request on the customer's phone for M-Pesa/e-Mola.
curl -X POST https://api.txenka.com/v1/payment-intents/pi_01hx4k9…/confirm \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."The returned status can be processing (awaiting customer confirmation), succeeded or failed. For asynchronous methods, subscribe to a webhook to know when the state changes without polling the API.
mpesa
M-Pesa — Vodacom mobile wallet
emola
e-Mola — Movitel mobile wallet
card
Card — Visa and Mastercard
bank_transfer
Bank transfer
Configure an endpoint under Settings → Webhooks in the dashboard to receive an HTTP POST notification whenever a payment's status changes — without polling the API.
Main events
payment_intent.succeeded
The payment was confirmed successfully.
payment_intent.failed
The payment failed or was declined.
payment_intent.processing
Awaiting customer confirmation (e.g. STK push sent).
Errors always follow the same shape, with a stable code you can handle programmatically and a human-readable message.
{
"error": {
"code": "payment_method_disabled",
"message": "O método de pagamento 'mpesa' não está activo para esta conta."
}
}