Skip to main content

ClicToPay

ClicToPay is the hosted card payment page of the Société Monétique Tunisie (SMT). It is unrelated to EMVCo's international Click to Pay. CWMerch's adapter is cwmerch-api/internal/payments/clictopay.go, next to Stripe, Konnect and Flouci.

Not yet tested with real ClicToPay credentials. SMT publishes no API specification: its integration manual is handed to merchants with their credentials. Every fact below is marked with where it comes from; check the ones to confirm against your copy of the manual before going live.

Sources​

MarkSource
[SMT]monetiquetunisie.com: confirms clictopay is SMT's e-commerce platform; no technical content
[observed]Answers of test.clictopay.com and ipay.clictopay.com to empty requests without credentials (2026-12-03)
[community]Code written from SMT's manual: WooCommerce module 3.x, PrestaShop module, PHP SDK, unofficial OpenAPI
[BPC]BPC gateway reference: ClicToPay has the same operations, paths and fields. That it runs this platform is an inference, not an SMT statement

Not readable: the 2016 manual on docplayer (403), clictopay.com and clictopay.com.tn (no DNS answer).

Authentication and environments​

  • userName and password of the merchant's API account, sent with every request [community]. They differ from the monitoring portal's, and test and production have their own [community].
  • cwmerch sends them in the body of a POST, never in the URL.
  • Test: https://test.clictopay.com/payment/rest — production: https://ipay.clictopay.com/payment/rest [community], both answering [observed].
  • An error is an errorCode other than 0, as a number or as text, with HTTP 200 or 400 [observed].

Operations​

All are POST, application/x-www-form-urlencoded, JSON answers, with userName, password, language.

OperationParametersAnswerIn cwmerch
register.do [community, observed]orderNumber (unique, 32 characters at most), amount (minor units: millimes for TND), currency (ISO 4217 number: 788, 978, 840), returnUrl, failUrl, description, pageView, sessionTimeoutSecsorderId, formUrlused
getOrderStatusExtended.do [community, observed]orderIdorderStatus, actionCode, actionCodeDescription, amount, currency, orderNumber, authRefNum…used
getOrderStatus.do [community]orderIdolder, shorter statusnot used
reverse.do (cancel) [community, observed]orderIderrorCode, errorMessagenot supported
refund.do (full or partial) [community, observed]orderId, amounterrorCode, errorMessagenot supported
registerPreAuth.do, deposit.do [community]two-step paymentsnot supported

For reverse.do and refund.do, [observed] only means the operation exists (it answers "Access denied").

Error codes: 1 duplicate order number, 4 missing parameter [community], also an empty userName [observed]; 5 access denied, also a missing parameter [observed]; 6 unknown orderId (to confirm: the connection test relies on it).

Statuses​

orderStatus [BPC], 2 = paid also [community]cwmerch
0 registered, 1 amount held, 5 3-D Secure under way, 7 pending, 8 partial completionpending
2 paidpaid
3 cancelled, 4 refunded, 6 declinedfailed
actionCode -2007 (page expired) with an unpaid statusfailed, "expired"
anything else, an errorCode, a timeout, unreadable JSONunknown: the order is left as it is

Payment lifecycle​

  1. Checkout creates the order pending and calls register.do with the order number order-<id>-<time>, different at each attempt. The returned orderId is kept in the order meta _cwmerch_payment_ref and in an order note.
  2. The customer is redirected to formUrl. cwmerch never sees a card number or CVV.
  3. returnUrl and failUrl are the same page, /checkout/payment/{id}?key=. Coming back proves nothing: the page makes the API ask getOrderStatusExtended.do, and only that answer decides.
  4. Paid: the order moves to processing with authRefNum as its transaction id (else the orderId), once. Failed: the order is failed and the customer can try again; the API first checks that the previous attempt wasn't paid. Paid for less than the total: left pending with a note.
  5. A customer who pays and closes the browser is caught by a background check: every 5 minutes, the pending ClicToPay orders less than 3 days old are re-read (internal/payments/poll.go).

Server notifications​

No notification is documented for ClicToPay merchants in any source found, so none is implemented: /v1/payments/clictopay/webhook answers 400 and never changes an order. BPC gateways can send signed callbacks (mdOrder, operation, status, HMAC checksum) [BPC]; whether SMT offers them, and with which key, is a question for SMT.

Configuration​

Administration → Settings → Payments → Online payments → ClicToPay, or from the environment when nothing is stored in the administration:

SettingEnvironment
API loginCLICTOPAY_USER_NAMErequired
API password (sealed in the database with CWMERCH_SECRET_KEY)CLICTOPAY_PASSWORDrequired
ModeCLICTOPAY_MODEtest (default) or live
Payment page languageCLICTOPAY_LANGUAGEfr (default), en, ar
Session timeout in secondsCLICTOPAY_SESSION_TIMEOUT_SECSempty: ClicToPay's own (about 20 minutes [community])
CLICTOPAY_API_BASEoverrides the API address (tests against a fake server)

The provider must then be enabled in the administration. The return address is built from CWMERCH_UI_URL, which must be public and in HTTPS.

Testing​

  • Unit tests, against a local fake server: cd cwmerch-api && go test ./internal/payments.
  • Sandbox: enter the test credentials, mode Test, then Test the connection. Place an order and pay with the test cards SMT gave you. cwmerch logs each raw ClicToPay answer in test mode only (clictopay test answer), never the password.

Going to production​

  1. Open a merchant account through your bank, and get the integration manual, test credentials and cards.
  2. Run SMT's acceptance grid. It wants the raw JSON answers received by the shop itself, not by Postman [community]: take them from the logs above. Its "missing amount", "duplicate number" and "unknown orderId" cases can't be produced by a normal checkout; cwmerch has no screen to provoke them.
  3. Get the production credentials, enter them, switch the mode to Production and test the connection.
  4. Make a small real payment and refund it from the merchant portal.

In Test mode, keep the provider disabled on a public shop: real customers would reach the test page.

Known limits​

  • Refunds and cancellations are made in the merchant portal: cwmerch's payment adapters have no refund operation, for any provider. Record the refund in cwmerch afterwards.
  • Two open payment pages: only the last attempt of an order is followed. If a customer starts again and then pays on the first page, the order isn't updated; that attempt's reference is in the order notes.
  • EUR and USD are offered because other modules do; the contract decides.
  • Switching mode or credentials makes the payments under way unreadable with the new account.

To ask SMT or the bank​

  1. The current integration manual, and confirmation of the two API addresses.
  2. The meaning of orderStatus, of error code 6, and of the action codes.
  3. Are server notifications available? Method, parameters, signature and key?
  4. Maximum length of orderNumber and description; pageView and sessionTimeoutSecs values allowed.
  5. Is the API account allowed to reverse.do and refund.do, within which delays?
  6. Currencies of the contract, and any restriction on calling IP addresses.