Skip to content

Development environment: content is being written, nothing points to production.

Documentation contents

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

  • receiverWalletIdstringrequired

    Wallet (payment account) that receives the payment. receiverWallet is accepted as an alias.

  • amountintegerrequired

    Amount in minor units: millimes for TND (120000 is 120.000 TND).

    • min: 100
    • max: 30000000
  • tokenstring

    Currency. Only TND is served by the new platform.

    • enum: "TND"
  • descriptionstring

    Shown to the buyer on the payment page.

    • minLength: 3
    • maxLength: 280
  • lifespaninteger

    Minutes before the payment expires.

    • min: 1
    • max: 60
  • acceptedPaymentMethodsstring[]

    bank_card and e-DINAR map to the card providers active on your account, flouci to 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 with GET /api/v2/payments/{paymentId}.

  • silentWebhookboolean

    When true, Konnect calls the webhook server to server and sends the buyer to successUrl or failUrl.

  • successUrlstring (uri)

    Where the buyer lands after a successful payment (payment_ref is appended).

  • failUrlstring (uri)

    Where the buyer lands after a failed or cancelled payment (payment_ref is appended).

  • themestring

    Theme of the payment page.

    • enum: "light", "dark"
  • checkoutFormboolean

    Ask the buyer for name, e-mail and phone on the payment page.

  • addPaymentFeesToAmountboolean

    Deprecated: accepted and ignored (no Konnect fee on the flow).

  • orderIdstring

    Your order reference, returned on the payment.

  • typestring

    partial lets the buyer pay in several times.

    • enum: "immediate", "partial"
  • receiverPhoneNumberstring
  • firstNamestring
  • lastNamestring
  • emailstring (email)
  • phoneNumberstring

Responses

  • 200Payment created.

    • payUrlstring (uri)required

      Hosted payment page: redirect the buyer here.

    • paymentRefstringrequired

      24 hexadecimal characters; keep it with your order.

  • 400Validation error: one entry per invalid field.

    • errorsobject[]
      • msgstring
      • paramstring
  • 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

  • paymentIdstringpathrequired

    The paymentRef returned by init-payment (24 hexadecimal characters).

    • pattern: ^[a-f0-9]{24}$

Responses

  • 200The payment.

    • paymentPayment
      • idstring
      • statusstring

        completed once the amount is fully paid; only this status means paid.

        • enum: "pending", "completed", "failed", "canceled", "expired", "refunded", "partial"
      • amountinteger
      • tokenstring
      • descriptionstring
      • acceptedPaymentMethodsstring[]
      • linkstring (uri)
      • expirationDatestring (date-time)
      • orderIdstring
      • transactionsTransaction[]
        • idstring
        • amountinteger
        • methodstring
        • statusstring
          • enum: "pending_payment", "success", "failed_payment", "expired", "canceled", "refunded"
        • typestring
        • tokenstring
        • ext_payment_refstring

          Reference at the provider.

        • fromstring

          Provider 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"
}