API reference
API v2 (compatibility)
The v2 routes used by the WooCommerce and PrestaShop plugins and by existing integrations. They keep working unchanged: the new platform serves them for migrated organisations and relays them to the current platform for the others (spec 0.5). New integrations should use v3 once payments are available there.
Version 2.0.02 operationsGenerated from apps/docs/content/openapi/compat-v2.json (sha256 2525ddbe92ec)
Base URLs
https://api.preprod.konnect.networkSandbox: fictitious payments, test cards.https://api.konnect.networkProduction: real payments. Use only after the going-live checklist.
Authentication
x-api-key(header)Your API key,
<organisationId>:<secret>, from the dashboard. Keep it on your server: never in a browser, a mobile app or a URL.
payments
Create a payment, redirect the buyer to the hosted payment page, then read the payment to know its status.
Create a payment and get the payment page URL
POST/api/v2/payments/init-paymentAPI key
Creates a payment for the wallet (payment account) receiverWalletId. Redirect the buyer to payUrl. When the payment ends, Konnect calls webhook with ?payment_ref=<paymentRef>: this call carries no signature, so always confirm the status with GET /api/v2/payments/{paymentId} before delivering the order.
Parameters
No parameters.
Request body application/json
receiverWalletIdstringrequiredWallet (payment account) that receives the payment.
receiverWalletis accepted as an alias.amountintegerrequiredAmount in minor units: millimes for TND (
120000is 120.000 TND).- min: 100
- max: 30000000
tokenstringCurrency. Only TND is served by the new platform.
- enum: "TND"
descriptionstringShown to the buyer on the payment page.
- minLength: 3
- maxLength: 280
lifespanintegerMinutes before the payment expires.
- min: 1
- max: 60
acceptedPaymentMethodsstring[]bank_cardande-DINARmap to the card providers active on your account,floucito Flouci. Legacy values (wallet,konnect,MCOIN,wire_transfer,Paypal) are ignored.webhookstring (uri)Called with
?payment_ref=<paymentRef>when the payment ends. Not signed: confirm withGET /api/v2/payments/{paymentId}.silentWebhookbooleanWhen true, Konnect calls the webhook server to server and sends the buyer to
successUrlorfailUrl.successUrlstring (uri)Where the buyer lands after a successful payment (
payment_refis appended).failUrlstring (uri)Where the buyer lands after a failed or cancelled payment (
payment_refis appended).themestringTheme of the payment page.
- enum: "light", "dark"
checkoutFormbooleanAsk the buyer for name, e-mail and phone on the payment page.
addPaymentFeesToAmountbooleanDeprecated: accepted and ignored (no Konnect fee on the flow).
orderIdstringYour order reference, returned on the payment.
typestringpartiallets the buyer pay in several times.- enum: "immediate", "partial"
receiverPhoneNumberstringfirstNamestringlastNamestringemailstring (email)phoneNumberstring
Responses
200Payment created.
payUrlstring (uri)requiredHosted payment page: redirect the buyer here.
paymentRefstringrequired24 hexadecimal characters; keep it with your order.
400Validation error: one entry per invalid field.
errorsobject[]msgstringparamstring
401Missing or wrong
x-api-key.messagestring
422Business rule refused the payment (for example a currency the platform does not serve).
messagestring
Code samples
curl -X POST "$KONNECT_V2_URL/api/v2/payments/init-payment" \
-H "x-api-key: $KONNECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"receiverWalletId": "5f7a209aeb3f76490ac4a3d1",
"token": "TND",
"amount": 120000,
"description": "Order 1001",
"acceptedPaymentMethods": [
"bank_card",
"e-DINAR",
"flouci"
],
"lifespan": 20,
"checkoutForm": false,
"webhook": "https://shop.example.com/konnect/webhook",
"successUrl": "https://shop.example.com/checkout/success",
"failUrl": "https://shop.example.com/checkout/failure",
"theme": "light",
"orderId": "order-1001",
"firstName": "Salma",
"lastName": "Example",
"email": "buyer@example.com",
"phoneNumber": "22000000"
}'Example: request body
{
"receiverWalletId": "5f7a209aeb3f76490ac4a3d1",
"token": "TND",
"amount": 120000,
"description": "Order 1001",
"acceptedPaymentMethods": [
"bank_card",
"e-DINAR",
"flouci"
],
"lifespan": 20,
"checkoutForm": false,
"webhook": "https://shop.example.com/konnect/webhook",
"successUrl": "https://shop.example.com/checkout/success",
"failUrl": "https://shop.example.com/checkout/failure",
"theme": "light",
"orderId": "order-1001",
"firstName": "Salma",
"lastName": "Example",
"email": "buyer@example.com",
"phoneNumber": "22000000"
}Example: 200
{
"payUrl": "https://checkout.konnect.example/pay?payment_ref=665f1c2e8b3a4d0012ab34cd",
"paymentRef": "665f1c2e8b3a4d0012ab34cd"
}Example: 400
{
"errors": [
{
"msg": "amount must be between 100 and 30000000",
"param": "amount"
}
]
}Read a payment and its transactions
GET/api/v2/payments/{paymentId}API key
Returns the payment created by init-payment. Deliver the order only when status is completed and the amount matches your order. transactions lists each attempt at a provider.
Parameters
paymentIdstringpathrequiredThe
paymentRefreturned byinit-payment(24 hexadecimal characters).- pattern: ^[a-f0-9]{24}$
Responses
200The payment.
paymentPaymentidstringstatusstringcompletedonce the amount is fully paid; only this status means paid.- enum: "pending", "completed", "failed", "canceled", "expired", "refunded", "partial"
amountintegertokenstringdescriptionstringacceptedPaymentMethodsstring[]linkstring (uri)expirationDatestring (date-time)orderIdstringtransactionsTransaction[]idstringamountintegermethodstringstatusstring- enum: "pending_payment", "success", "failed_payment", "expired", "canceled", "refunded"
typestringtokenstringext_payment_refstringReference at the provider.
fromstringProvider code.
401Missing or wrong
x-api-key.messagestring
404No payment with this reference.
messagestring
Code samples
curl -X GET "$KONNECT_V2_URL/api/v2/payments/665f1c2e8b3a4d0012ab34cd" \
-H "x-api-key: $KONNECT_API_KEY"Example: 200
{
"payment": {
"id": "665f1c2e8b3a4d0012ab34cd",
"status": "completed",
"amount": 120000,
"token": "TND",
"description": "Order 1001",
"acceptedPaymentMethods": [
"bank_card",
"e-DINAR",
"flouci"
],
"link": "https://checkout.konnect.example/pay?payment_ref=665f1c2e8b3a4d0012ab34cd",
"expirationDate": "2026-10-01T09:50:00.000Z",
"orderId": "order-1001",
"transactions": [
{
"id": "665f1c4a8b3a4d0012ab34ce",
"amount": 120000,
"method": "bank_card",
"status": "success",
"type": "payment",
"token": "TND",
"ext_payment_ref": "TEST-000001",
"from": "clictopay"
}
]
}
}Example: 401
{
"message": "Unauthorized"
}