Create a payment
A payment_intent represents a charge. Amounts are always in cents (2450 = 24.50 MZN). amount, customer_email and customer_name are required; payment_method is optional — if omitted, the customer picks a method on the checkout page itself.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/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",
"customer_email": "cliente@exemplo.com",
"customer_name": "Ana Machava",
"description": "Pedido #1042",
"merchant_reference": "PEDIDO-1042"
}'const res = await fetch('https://api.txenka.com/api/v1/payment-intents', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 2450,
currency: 'MZN',
payment_method: 'mpesa',
customer_phone: '258840000000',
customer_email: 'cliente@exemplo.com',
customer_name: 'Ana Machava',
description: 'Pedido #1042',
merchant_reference: 'PEDIDO-1042',
}),
});
const intent = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-intents');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 2450,
'currency' => 'MZN',
'payment_method' => 'mpesa',
'customer_phone' => '258840000000',
'customer_email' => 'cliente@exemplo.com',
'customer_name' => 'Ana Machava',
'description' => 'Pedido #1042',
'merchant_reference' => 'PEDIDO-1042',
]),
]);
$intent = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/payment-intents",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"amount": 2450,
"currency": "MZN",
"payment_method": "mpesa",
"customer_phone": "258840000000",
"customer_email": "cliente@exemplo.com",
"customer_name": "Ana Machava",
"description": "Pedido #1042",
"merchant_reference": "PEDIDO-1042",
},
)
intent = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-intents')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
amount: 2450,
currency: 'MZN',
payment_method: 'mpesa',
customer_phone: '258840000000',
customer_email: 'cliente@exemplo.com',
customer_name: 'Ana Machava',
description: 'Pedido #1042',
merchant_reference: 'PEDIDO-1042',
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
intent = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"amount": 2450,
"currency": "MZN",
"payment_method": "mpesa",
"customer_phone": "258840000000",
"customer_email": "cliente@exemplo.com",
"customer_name": "Ana Machava",
"description": "Pedido #1042",
"merchant_reference": "PEDIDO-1042",
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/payment-intents", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"amount":2450,"currency":"MZN","payment_method":"mpesa",
"customer_phone":"258840000000","customer_email":"cliente@exemplo.com",
"customer_name":"Ana Machava","description":"Pedido #1042",
"merchant_reference":"PEDIDO-1042"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-intents"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString()); The response already includes a ready-to-use checkout_url — redirect the customer there and Txenka handles confirmation for you, no need to implement the next step. client_secret only authorizes reading/confirming this specific payment, never your other intents — safe to share over any channel (WhatsApp, SMS, email).
{
"object": "payment_intent",
"id": "01HX4K9GVZ3QY8N7T2WPJD5R6E",
"amount": 2450,
"amount_decimal": "24.50",
"currency": "MZN",
"status": "requires_confirmation",
"payment_method": "mpesa",
"description": "Pedido #1042",
"merchant_reference": "PEDIDO-1042",
"merchant": { "name": "A Tua Loja", "logo_url": null },
"available_payment_methods": [
{ "key": "mpesa", "name": "M-Pesa", "icon": "...", "type": "wallet", "needs_phone": true, "customer_instructions": "..." }
],
"checkout_url": "https://pay.txenka.com/checkout/01HX4K9GVZ3QY8N7T2WPJD5R6E_secret_a1b2c3...",
"client_secret": "01HX4K9GVZ3QY8N7T2WPJD5R6E_secret_a1b2c3...",
"customer": { "email": "cliente@exemplo.com", "phone": "+258840000000", "name": "Ana Machava" },
"success_url": null,
"cancel_url": null,
"failure_code": null,
"failure_message": null,
"metadata": {},
"latest_transaction": null,
"created_at": "2026-07-30T10:00:00+00:00",
"updated_at": "2026-07-30T10:00:00+00:00",
"cancelled_at": null,
"expires_at": "2026-07-30T11:00:00+00:00"
}
Manage Payment Intents
Beyond creating and confirming, list the intent history, cancel one for good, or let the customer pick a different method without losing the intent.
List
Filter by status, payment_method, from/to (dates), and paginate with limit.
cURL Node.js PHP Python Ruby Go Java
curl "https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20" \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$intents = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/payment-intents",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
params={"status": "succeeded", "limit": 20},
)
intents = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
intents = JSON.parse(res.body)['data']req, _ := http.NewRequest(
"GET",
"https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20",
nil,
)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-intents?status=succeeded&limit=20"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const intent = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$intent = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
intent = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
intent = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Cancel
Ends the intent for good — same as Stripe's PaymentIntent.cancel. Once cancelled (or already succeeded), there's no going back — use reset-method below if you only need the customer to try a different method.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel',
{ method: 'POST', headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const intent = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$intent = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
intent = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
intent = JSON.parse(res.body)req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/cancel"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.POST(HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Reset the payment method
Different from cancel: clears only the payment_method of the current attempt and returns the intent to requires_payment_method, without ending the intent or its checkout_url. Useful when a synchronous attempt (mpesa/card) was declined, or a manual/async attempt (bank transfer, SMS relay) was left pending and the customer gave up — lets them pick another method on the same link instead of you creating a new Payment Intent. Allowed from any non-terminal state, including failed (a decline is meant to be retried); blocked only from succeeded/cancelled.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method',
{ method: 'POST', headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const intent = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$intent = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
intent = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
intent = JSON.parse(res.body)req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-intents/01HX4K9GVZ3QY8N7T2WPJD5R6E/reset-method"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.POST(HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Refunds
Fully or partially refund a successful transaction. Methods with automatic reversal change state right away; manual ones (bank transfer, SMS relay) stay pending until you're notified by webhook.
List
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/refunds \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/refunds', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/refunds');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$refunds = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/refunds",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
refunds = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/refunds')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
refunds = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/refunds", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/refunds"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create (on a transaction)
amount is optional — omitted, it refunds whatever hasn't been refunded yet. reason accepts duplicate, fraudulent, requested_by_customer or other.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"reason": "requested_by_customer",
"notes": "Cliente desistiu da encomenda"
}'const res = await fetch(
'https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds',
{
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 1000,
reason: 'requested_by_customer',
notes: 'Cliente desistiu da encomenda',
}),
}
);
const refund = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1000,
'reason' => 'requested_by_customer',
'notes' => 'Cliente desistiu da encomenda',
]),
]);
$refund = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"amount": 1000,
"reason": "requested_by_customer",
"notes": "Cliente desistiu da encomenda",
},
)
refund = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
amount: 1000,
reason: 'requested_by_customer',
notes: 'Cliente desistiu da encomenda',
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
refund = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"amount": 1000,
"reason": "requested_by_customer",
"notes": "Cliente desistiu da encomenda",
})
req, _ := http.NewRequest(
"POST",
"https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds",
bytes.NewBuffer(body),
)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"amount":1000,"reason":"requested_by_customer",
"notes":"Cliente desistiu da encomenda"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/transactions/txn_01hx4k9…/refunds"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/refunds/re_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/refunds/re_01hx4k9…', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const refund = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/refunds/re_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$refund = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/refunds/re_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
refund = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/refunds/re_01hx4k9…')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
refund = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/refunds/re_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/refunds/re_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Customers
A simple record for your customer — name, email, phone — to reuse on invoices and to search their payment history.
List
cURL Node.js PHP Python Ruby Go Java
curl "https://api.txenka.com/api/v1/customers?search=Ana&limit=25" \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/customers?search=Ana&limit=25',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/customers?search=Ana&limit=25');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$customers = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/customers",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
params={"search": "Ana", "limit": 25},
)
customers = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/customers?search=Ana&limit=25')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
customers = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/customers?search=Ana&limit=25", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/customers?search=Ana&limit=25"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/customers \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"name": "Ana Machava",
"email": "ana@example.com",
"phone": "258840000000",
"country": "MZ"
}'const res = await fetch('https://api.txenka.com/api/v1/customers', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Ana Machava',
email: 'ana@example.com',
phone: '258840000000',
country: 'MZ',
}),
});
const customer = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/customers');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Ana Machava',
'email' => 'ana@example.com',
'phone' => '258840000000',
'country' => 'MZ',
]),
]);
$customer = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/customers",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"name": "Ana Machava",
"email": "ana@example.com",
"phone": "258840000000",
"country": "MZ",
},
)
customer = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/customers')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
name: 'Ana Machava',
email: 'ana@example.com',
phone: '258840000000',
country: 'MZ',
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
customer = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"name": "Ana Machava",
"email": "ana@example.com",
"phone": "258840000000",
"country": "MZ",
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/customers", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"name":"Ana Machava","email":"ana@example.com",
"phone":"258840000000","country":"MZ"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/customers"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/customers/cus_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/customers/cus_01hx4k9…', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const customer = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/customers/cus_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$customer = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/customers/cus_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
customer = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/customers/cus_01hx4k9…')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
customer = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/customers/cus_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/customers/cus_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/customers/cus_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"phone": "258850000000"}'const res = await fetch('https://api.txenka.com/api/v1/customers/cus_01hx4k9…', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ phone: '258850000000' }),
});
const customer = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/customers/cus_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['phone' => '258850000000']),
]);
$customer = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/customers/cus_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"phone": "258850000000"},
)
customer = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/customers/cus_01hx4k9…')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { phone: '258850000000' }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
customer = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"phone": "258850000000"})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/customers/cus_01hx4k9…", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/customers/cus_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\\"phone\\":\\"258850000000\\"}"))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Delete
cURL Node.js PHP Python Ruby Go Java
curl -X DELETE https://api.txenka.com/api/v1/customers/cus_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."await fetch('https://api.txenka.com/api/v1/customers/cus_01hx4k9…', {
method: 'DELETE',
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});$ch = curl_init('https://api.txenka.com/api/v1/customers/cus_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
curl_exec($ch);import requests
requests.delete(
"https://api.txenka.com/api/v1/customers/cus_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)require 'net/http'
uri = URI('https://api.txenka.com/api/v1/customers/cus_01hx4k9…')
req = Net::HTTP::Delete.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }req, _ := http.NewRequest("DELETE", "https://api.txenka.com/api/v1/customers/cus_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/customers/cus_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.DELETE()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Products
A simple catalog to reuse on invoices and payment links. Note: unlike payment_intents, price here is a decimal value in the major unit (899.90 = 899.90 MZN) — the API converts to cents internally.
List
cURL Node.js PHP Python Ruby Go Java
curl "https://api.txenka.com/api/v1/products?status=active&search=camisa" \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/products?status=active&search=camisa',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/products?status=active&search=camisa');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$products = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/products",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
params={"status": "active", "search": "camisa"},
)
products = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/products?status=active&search=camisa')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
products = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/products?status=active&search=camisa", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/products?status=active&search=camisa"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/products \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"name": "Camisa polo",
"price": 899.90,
"currency": "MZN",
"sku": "POLO-001"
}'const res = await fetch('https://api.txenka.com/api/v1/products', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Camisa polo',
price: 899.90,
currency: 'MZN',
sku: 'POLO-001',
}),
});
const product = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/products');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Camisa polo',
'price' => 899.90,
'currency' => 'MZN',
'sku' => 'POLO-001',
]),
]);
$product = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/products",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"name": "Camisa polo",
"price": 899.90,
"currency": "MZN",
"sku": "POLO-001",
},
)
product = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/products')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
name: 'Camisa polo',
price: 899.90,
currency: 'MZN',
sku: 'POLO-001',
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
product = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"name": "Camisa polo",
"price": 899.90,
"currency": "MZN",
"sku": "POLO-001",
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/products", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"name":"Camisa polo","price":899.90,
"currency":"MZN","sku":"POLO-001"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/products"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/products/prod_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/products/prod_01hx4k9…', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const product = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/products/prod_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$product = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/products/prod_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
product = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/products/prod_01hx4k9…')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
product = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/products/prod_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/products/prod_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/products/prod_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"price": 949.90, "status": "inactive"}'const res = await fetch('https://api.txenka.com/api/v1/products/prod_01hx4k9…', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ price: 949.90, status: 'inactive' }),
});
const product = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/products/prod_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['price' => 949.90, 'status' => 'inactive']),
]);
$product = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/products/prod_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"price": 949.90, "status": "inactive"},
)
product = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/products/prod_01hx4k9…')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { price: 949.90, status: 'inactive' }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
product = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"price": 949.90, "status": "inactive"})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/products/prod_01hx4k9…", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/products/prod_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\\"price\\":949.90,\\"status\\":\\"inactive\\"}"))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Delete
cURL Node.js PHP Python Ruby Go Java
curl -X DELETE https://api.txenka.com/api/v1/products/prod_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."await fetch('https://api.txenka.com/api/v1/products/prod_01hx4k9…', {
method: 'DELETE',
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});$ch = curl_init('https://api.txenka.com/api/v1/products/prod_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
curl_exec($ch);import requests
requests.delete(
"https://api.txenka.com/api/v1/products/prod_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)require 'net/http'
uri = URI('https://api.txenka.com/api/v1/products/prod_01hx4k9…')
req = Net::HTTP::Delete.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }req, _ := http.NewRequest("DELETE", "https://api.txenka.com/api/v1/products/prod_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/products/prod_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.DELETE()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Invoices
Aggregates several line_items into a total billed to a customer, with a due date. Same decimal convention as Products for prices/quantities.
List
cURL Node.js PHP Python Ruby Go Java
curl "https://api.txenka.com/api/v1/invoices?status=sent&limit=25" \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/invoices?status=sent&limit=25',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/invoices?status=sent&limit=25');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$invoices = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/invoices",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
params={"status": "sent", "limit": 25},
)
invoices = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/invoices?status=sent&limit=25')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
invoices = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/invoices?status=sent&limit=25", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/invoices?status=sent&limit=25"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create
The invoice number (INV-2026-0001) is generated automatically. Totals (subtotal, total) are computed from line_items, not sent by you.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/invoices \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_01hx4k9…",
"issued_at": "2026-07-30",
"due_at": "2026-08-13",
"line_items": [
{"description": "Camisa polo", "quantity": 2, "unit_price": 899.90}
]
}'const res = await fetch('https://api.txenka.com/api/v1/invoices', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
customer_id: 'cus_01hx4k9…',
issued_at: '2026-07-30',
due_at: '2026-08-13',
line_items: [{ description: 'Camisa polo', quantity: 2, unit_price: 899.90 }],
}),
});
const invoice = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => 'cus_01hx4k9…',
'issued_at' => '2026-07-30',
'due_at' => '2026-08-13',
'line_items' => [
['description' => 'Camisa polo', 'quantity' => 2, 'unit_price' => 899.90],
],
]),
]);
$invoice = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/invoices",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"customer_id": "cus_01hx4k9…",
"issued_at": "2026-07-30",
"due_at": "2026-08-13",
"line_items": [
{"description": "Camisa polo", "quantity": 2, "unit_price": 899.90},
],
},
)
invoice = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/invoices')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
customer_id: 'cus_01hx4k9…',
issued_at: '2026-07-30',
due_at: '2026-08-13',
line_items: [{ description: 'Camisa polo', quantity: 2, unit_price: 899.90 }],
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
invoice = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"customer_id": "cus_01hx4k9…",
"issued_at": "2026-07-30",
"due_at": "2026-08-13",
"line_items": []map[string]any{
{"description": "Camisa polo", "quantity": 2, "unit_price": 899.90},
},
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/invoices", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"customer_id":"cus_01hx4k9…","issued_at":"2026-07-30","due_at":"2026-08-13",
"line_items":[{"description":"Camisa polo","quantity":2,"unit_price":899.90}]}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/invoices"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/invoices/inv_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const invoice = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$invoice = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/invoices/inv_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
invoice = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
invoice = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/invoices/inv_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/invoices/inv_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update (status, notes, due date)
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/invoices/inv_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"status": "paid", "paid_at": "2026-07-30T10:00:00Z"}'const res = await fetch('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ status: 'paid', paid_at: '2026-07-30T10:00:00Z' }),
});
const invoice = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['status' => 'paid', 'paid_at' => '2026-07-30T10:00:00Z']),
]);
$invoice = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/invoices/inv_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"status": "paid", "paid_at": "2026-07-30T10:00:00Z"},
)
invoice = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { status: 'paid', paid_at: '2026-07-30T10:00:00Z' }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
invoice = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"status": "paid", "paid_at": "2026-07-30T10:00:00Z"})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/invoices/inv_01hx4k9…", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/invoices/inv_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\\"status\\":\\"paid\\",\\"paid_at\\":\\"2026-07-30T10:00:00Z\\"}"))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Delete
cURL Node.js PHP Python Ruby Go Java
curl -X DELETE https://api.txenka.com/api/v1/invoices/inv_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."await fetch('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…', {
method: 'DELETE',
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});$ch = curl_init('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
curl_exec($ch);import requests
requests.delete(
"https://api.txenka.com/api/v1/invoices/inv_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)require 'net/http'
uri = URI('https://api.txenka.com/api/v1/invoices/inv_01hx4k9…')
req = Net::HTTP::Delete.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }req, _ := http.NewRequest("DELETE", "https://api.txenka.com/api/v1/invoices/inv_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/invoices/inv_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.DELETE()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Payment Links
A hosted, reusable checkout page with your own slug — share it on WhatsApp/social media without writing code. Same decimal convention for amount.
List
cURL Node.js PHP Python Ruby Go Java
curl "https://api.txenka.com/api/v1/payment-links?status=active" \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/payment-links?status=active',
{ headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-links?status=active');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$links = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/payment-links",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
params={"status": "active"},
)
links = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-links?status=active')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
links = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/payment-links?status=active", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-links?status=active"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/payment-links \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"name": "Pedido personalizado",
"amount": 500.00,
"currency": "MZN"
}'const res = await fetch('https://api.txenka.com/api/v1/payment-links', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Pedido personalizado',
amount: 500.00,
currency: 'MZN',
}),
});
const link = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-links');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Pedido personalizado',
'amount' => 500.00,
'currency' => 'MZN',
]),
]);
$link = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/payment-links",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"name": "Pedido personalizado", "amount": 500.00, "currency": "MZN"},
)
link = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-links')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { name: 'Pedido personalizado', amount: 500.00, currency: 'MZN' }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
link = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"name": "Pedido personalizado",
"amount": 500.00,
"currency": "MZN",
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/payment-links", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"name":"Pedido personalizado","amount":500.00,"currency":"MZN"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-links"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/payment-links/pl_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const link = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$link = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
link = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
link = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/payment-links/pl_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"status": "inactive"}'const res = await fetch('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ status: 'inactive' }),
});
const link = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['status' => 'inactive']),
]);
$link = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"status": "inactive"},
)
link = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { status: 'inactive' }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
link = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"status": "inactive"})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\\"status\\":\\"inactive\\"}"))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Delete
cURL Node.js PHP Python Ruby Go Java
curl -X DELETE https://api.txenka.com/api/v1/payment-links/pl_01hx4k9… \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."await fetch('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…', {
method: 'DELETE',
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});$ch = curl_init('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
curl_exec($ch);import requests
requests.delete(
"https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)require 'net/http'
uri = URI('https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…')
req = Net::HTTP::Delete.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }req, _ := http.NewRequest("DELETE", "https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-links/pl_01hx4k9…"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.DELETE()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Store Profile
Public and contact data for your account, and which payment methods are active and how they're configured.
Retrieve the profile
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/merchants/me \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/merchants/me', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const merchant = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$merchant = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/merchants/me",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
merchant = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
merchant = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/merchants/me", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update the profile
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/merchants/me \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"support_email": "suporte@minhaloja.co.mz", "website": "https://minhaloja.co.mz"}'const res = await fetch('https://api.txenka.com/api/v1/merchants/me', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
support_email: 'suporte@minhaloja.co.mz',
website: 'https://minhaloja.co.mz',
}),
});
const merchant = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'support_email' => 'suporte@minhaloja.co.mz',
'website' => 'https://minhaloja.co.mz',
]),
]);
$merchant = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/merchants/me",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"support_email": "suporte@minhaloja.co.mz",
"website": "https://minhaloja.co.mz",
},
)
merchant = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
support_email: 'suporte@minhaloja.co.mz',
website: 'https://minhaloja.co.mz',
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
merchant = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"support_email": "suporte@minhaloja.co.mz",
"website": "https://minhaloja.co.mz",
})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/merchants/me", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"support_email":"suporte@minhaloja.co.mz",
"website":"https://minhaloja.co.mz"}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Active methods
enabled_methods may only contain methods already authorized by Txenka for your account (see merchant.payment_methods.authorized in the GET /merchants/me response) — use the request endpoint below to ask for a new one.
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/merchants/me/payment-methods \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"enabled_methods": ["mpesa", "emola", "card"]}'const res = await fetch('https://api.txenka.com/api/v1/merchants/me/payment-methods', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ enabled_methods: ['mpesa', 'emola', 'card'] }),
});
const merchant = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me/payment-methods');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['enabled_methods' => ['mpesa', 'emola', 'card']]),
]);
$merchant = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/merchants/me/payment-methods",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"enabled_methods": ["mpesa", "emola", "card"]},
)
merchant = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me/payment-methods')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { enabled_methods: ['mpesa', 'emola', 'card'] }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
merchant = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"enabled_methods": []string{"mpesa", "emola", "card"}})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/merchants/me/payment-methods", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"enabled_methods":["mpesa","emola","card"]}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me/payment-methods"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve a method's config
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const config = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$config = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
config = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
config = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Configure a method (direct vs custom)
mode: "direct" uses Txenka's official/pooled integration; mode: "custom" uses your own credentials with the operator/bank (stored encrypted). Requires KYC and KYB approved.
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"mode": "custom",
"credentials": {"api_key": "...", "public_key": "..."},
"enabled": true
}'const res = await fetch('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
mode: 'custom',
credentials: { api_key: '...', public_key: '...' },
enabled: true,
}),
});
const config = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'mode' => 'custom',
'credentials' => ['api_key' => '...', 'public_key' => '...'],
'enabled' => true,
]),
]);
$config = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"mode": "custom",
"credentials": {"api_key": "...", "public_key": "..."},
"enabled": True,
},
)
config = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
mode: 'custom',
credentials: { api_key: '...', public_key: '...' },
enabled: true,
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
config = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"mode": "custom",
"credentials": map[string]any{"api_key": "...", "public_key": "..."},
"enabled": true,
})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"mode":"custom","credentials":{"api_key":"...","public_key":"..."},
"enabled":true}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me/payment-methods/mpesa"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Request authorization for a method
Sends a request to an admin to enable a method not yet authorized for your account (e.g. bank_transfer_atm). Idempotent — re-requesting just reopens an existing rejected/pending request.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch(
'https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request',
{ method: 'POST', headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' } }
);
const merchant = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$merchant = json_decode(curl_exec($ch), true);import requests
response = requests.post(
"https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
merchant = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
merchant = JSON.parse(res.body)req, _ := http.NewRequest(
"POST",
"https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request",
nil,
)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/merchants/me/payment-methods/bank_transfer_atm/request"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.POST(HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
API Keys
Create and manage your API keys — each with its own type (test/live), scopes, and optionally an IP whitelist and expiration.
List
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/api-keys \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/api-keys', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/api-keys');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$keys = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/api-keys",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
keys = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/api-keys')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
keys = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/api-keys", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Create
The full key value is only ever returned in this response — save it now, it can't be retrieved afterward.
cURL Node.js PHP Python Ruby Go Java
curl -X POST https://api.txenka.com/api/v1/api-keys \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{
"name": "Integração e-commerce",
"type": "test",
"kind": "secret",
"scopes": ["payments:read", "payments:write", "payments:confirm"]
}'const res = await fetch('https://api.txenka.com/api/v1/api-keys', {
method: 'POST',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Integração e-commerce',
type: 'test',
kind: 'secret',
scopes: ['payments:read', 'payments:write', 'payments:confirm'],
}),
});
const key = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/api-keys');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Integração e-commerce',
'type' => 'test',
'kind' => 'secret',
'scopes' => ['payments:read', 'payments:write', 'payments:confirm'],
]),
]);
$key = json_decode(curl_exec($ch), true);
// $key['key'] só vem aqui, na criação — guarda-o já.import requests
response = requests.post(
"https://api.txenka.com/api/v1/api-keys",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={
"name": "Integração e-commerce",
"type": "test",
"kind": "secret",
"scopes": ["payments:read", "payments:write", "payments:confirm"],
},
)
key = response.json() # key["key"] só vem aqui, na criação — guarda-o já.require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/api-keys')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = {
name: 'Integração e-commerce',
type: 'test',
kind: 'secret',
scopes: ['payments:read', 'payments:write', 'payments:confirm'],
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
key = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{
"name": "Integração e-commerce",
"type": "test",
"kind": "secret",
"scopes": []string{"payments:read", "payments:write", "payments:confirm"},
})
req, _ := http.NewRequest("POST", "https://api.txenka.com/api/v1/api-keys", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var body = """
{"name":"Integração e-commerce","type":"test","kind":"secret",
"scopes":["payments:read","payments:write","payments:confirm"]}""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Retrieve one
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/api-keys/17 \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/api-keys/17', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const key = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/api-keys/17');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$key = json_decode(curl_exec($ch), true);import requests
response = requests.get(
"https://api.txenka.com/api/v1/api-keys/17",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
key = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/api-keys/17')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
key = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/api-keys/17", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys/17"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Update (name, scopes, IP whitelist)
cURL Node.js PHP Python Ruby Go Java
curl -X PATCH https://api.txenka.com/api/v1/api-keys/17 \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..." \
-H "Content-Type: application/json" \
-d '{"scopes": ["payments:read", "transactions:read"]}'const res = await fetch('https://api.txenka.com/api/v1/api-keys/17', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer txk_test_8f2a3c9d1e...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ scopes: ['payments:read', 'transactions:read'] }),
});
const key = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/api-keys/17');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer txk_test_8f2a3c9d1e...',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['scopes' => ['payments:read', 'transactions:read']]),
]);
$key = json_decode(curl_exec($ch), true);import requests
response = requests.patch(
"https://api.txenka.com/api/v1/api-keys/17",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
json={"scopes": ["payments:read", "transactions:read"]},
)
key = response.json()require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/api-keys/17')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
req['Content-Type'] = 'application/json'
req.body = { scopes: ['payments:read', 'transactions:read'] }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
key = JSON.parse(res.body)body, _ := json.Marshal(map[string]any{"scopes": []string{"payments:read", "transactions:read"}})
req, _ := http.NewRequest("PATCH", "https://api.txenka.com/api/v1/api-keys/17", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys/17"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\\"scopes\\":[\\"payments:read\\",\\"transactions:read\\"]}"))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Revoke
cURL Node.js PHP Python Ruby Go Java
curl -X DELETE https://api.txenka.com/api/v1/api-keys/17 \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."await fetch('https://api.txenka.com/api/v1/api-keys/17', {
method: 'DELETE',
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});$ch = curl_init('https://api.txenka.com/api/v1/api-keys/17');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
curl_exec($ch);import requests
requests.delete(
"https://api.txenka.com/api/v1/api-keys/17",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)require 'net/http'
uri = URI('https://api.txenka.com/api/v1/api-keys/17')
req = Net::HTTP::Delete.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }req, _ := http.NewRequest("DELETE", "https://api.txenka.com/api/v1/api-keys/17", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys/17"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.DELETE()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
List available scopes
Returns the same scope catalog described in the Authentication section — handy for building a scope-picker UI without hardcoding the list.
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/api-keys/scopes \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/api-keys/scopes', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { scopes } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/api-keys/scopes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$scopes = json_decode(curl_exec($ch), true)['scopes'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/api-keys/scopes",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
scopes = response.json()["scopes"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/api-keys/scopes')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
scopes = JSON.parse(res.body)['scopes']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/api-keys/scopes", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/api-keys/scopes"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Catalog
A static (but deploy-free updatable) reference of the payment methods, banks and currencies the platform supports.
Payment methods
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/payment-methods \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/payment-methods', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/payment-methods');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$methods = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/payment-methods",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
methods = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/payment-methods')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
methods = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/payment-methods", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/payment-methods"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
mpesa
M-Pesa (Vodacom) — direct integration, requires customer_phone
emola
e-Mola (Movitel) — direct integration, requires customer_phone
card
Card — Visa and Mastercard
bank_transfer_momo
Transfer from a mobile wallet to a bank account — requires customer_phone
bank_transfer_b2b
Transfer from the customer's own bank account — no customer_phone
bank_transfer_atm
Transfer via an ATM — no customer_phone
mpesa_sms
M-Pesa via the Android App (SMS relay) — requires customer_phone
emola_sms
e-Mola via the Android App (SMS relay) — requires customer_phone
mkesh_sms
Mkesh (Millennium bim) via the Android App — only channel available, requires customer_phone
Supported banks
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/banks \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/banks', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/banks');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$banks = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/banks",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
banks = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/banks')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
banks = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/banks", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/banks"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
Supported currencies
cURL Node.js PHP Python Ruby Go Java
curl https://api.txenka.com/api/v1/currencies \
-H "Authorization: Bearer txk_test_8f2a3c9d1e..."const res = await fetch('https://api.txenka.com/api/v1/currencies', {
headers: { 'Authorization': 'Bearer txk_test_8f2a3c9d1e...' },
});
const { data } = await res.json();$ch = curl_init('https://api.txenka.com/api/v1/currencies');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer txk_test_8f2a3c9d1e...'],
]);
$currencies = json_decode(curl_exec($ch), true)['data'];import requests
response = requests.get(
"https://api.txenka.com/api/v1/currencies",
headers={"Authorization": "Bearer txk_test_8f2a3c9d1e..."},
)
currencies = response.json()["data"]require 'net/http'
require 'json'
uri = URI('https://api.txenka.com/api/v1/currencies')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer txk_test_8f2a3c9d1e...'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
currencies = JSON.parse(res.body)['data']req, _ := http.NewRequest("GET", "https://api.txenka.com/api/v1/currencies", nil)
req.Header.Set("Authorization", "Bearer txk_test_8f2a3c9d1e...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.txenka.com/api/v1/currencies"))
.header("Authorization", "Bearer txk_test_8f2a3c9d1e...")
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());