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
| Mark | Source |
|---|---|
| [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
userNameandpasswordof 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
errorCodeother 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.
| Operation | Parameters | Answer | In 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, sessionTimeoutSecs | orderId, formUrl | used |
getOrderStatusExtended.do [community, observed] | orderId | orderStatus, actionCode, actionCodeDescription, amount, currency, orderNumber, authRefNum… | used |
getOrderStatus.do [community] | orderId | older, shorter status | not used |
reverse.do (cancel) [community, observed] | orderId | errorCode, errorMessage | not supported |
refund.do (full or partial) [community, observed] | orderId, amount | errorCode, errorMessage | not supported |
registerPreAuth.do, deposit.do [community] | two-step payments | not 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 completion | pending |
| 2 paid | paid |
| 3 cancelled, 4 refunded, 6 declined | failed |
actionCode -2007 (page expired) with an unpaid status | failed, "expired" |
anything else, an errorCode, a timeout, unreadable JSON | unknown: the order is left as it is |
Payment lifecycle
- Checkout creates the order pending and calls
register.dowith the order numberorder-<id>-<time>, different at each attempt. The returnedorderIdis kept in the order meta_cwmerch_payment_refand in an order note. - The customer is redirected to
formUrl. cwmerch never sees a card number or CVV. returnUrlandfailUrlare the same page,/checkout/payment/{id}?key=. Coming back proves nothing: the page makes the API askgetOrderStatusExtended.do, and only that answer decides.- Paid: the order moves to processing with
authRefNumas its transaction id (else theorderId), 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. - 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:
| Setting | Environment | |
|---|---|---|
| API login | CLICTOPAY_USER_NAME | required |
API password (sealed in the database with CWMERCH_SECRET_KEY) | CLICTOPAY_PASSWORD | required |
| Mode | CLICTOPAY_MODE | test (default) or live |
| Payment page language | CLICTOPAY_LANGUAGE | fr (default), en, ar |
| Session timeout in seconds | CLICTOPAY_SESSION_TIMEOUT_SECS | empty: ClicToPay's own (about 20 minutes [community]) |
CLICTOPAY_API_BASE | overrides 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
- Open a merchant account through your bank, and get the integration manual, test credentials and cards.
- 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.
- Get the production credentials, enter them, switch the mode to Production and test the connection.
- 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
- The current integration manual, and confirmation of the two API addresses.
- The meaning of
orderStatus, of error code 6, and of the action codes. - Are server notifications available? Method, parameters, signature and key?
- Maximum length of
orderNumberanddescription;pageViewandsessionTimeoutSecsvalues allowed. - Is the API account allowed to
reverse.doandrefund.do, within which delays? - Currencies of the contract, and any restriction on calling IP addresses.