Skip to main content

Payments API

At a glance​

The Payments API lets your server send payments to Monek directly, with no customer on a payment page. Use it for repeat and recurring charges, refunds, and call centre payments.

For taking payments on your website, the Checkout Page is usually the better choice. It handles card details and 3-D Secure for you.

Try it​

See how a Payments API request works, step by step. This is a simulation: nothing is sent to Monek.

  1. 1Request
  2. 2Process
  3. 3Response

1. Your server sends a request

Try 25.00 (approved) or 120.00 (declined), the same rules as a Monek test account. Clear the ApiKey to see what happens without it.

Sending card details from your own systems requires PCI DSS accreditation. For payments on your website, use the Checkout Page instead.

The request your server sends:

POST /Secure/Transact.ashx HTTP/1.1
Host: elite.monek.com
Content-Type: application/x-www-form-urlencoded

MerchantID=0000000&ApiKey=YOUR_API_KEY&Amount=2500&CountryCode=826&CurrencyCode=826&MessageType=SALE_CNP_TO&Dispatch=NOW&ResponseAction=JSON&ThreeDSAction=NONE&CardNumber=&ExpiryMonth=&ExpiryYear=&CV2=&PaymentReference=ORDER-1001

Before you start​

Testing your integration

Staging is not a sandbox. To test your integration, request a test Merchant ID from support@monek.com. Test Merchant IDs return simulated responses based on the transaction amount. See Test Cards for the expected responses.

Never send real card details to a test Merchant ID, and never use your live Merchant ID for testing on either gateway.

Authentication​

Every Payments API request must include your MerchantID and ApiKey. Contact Monek Support to get your API key.

info

ApiKey is replacing ValidityID and will be required for all direct server to server transaction requests. All new integrations should ensure ApiKey is populated in preparation for this change.

If you have already been issued a ValidityID you can continue to use this value as your ApiKey.

ApiKey and ValidityID must be kept private and should only be used on direct API calls. ApiKeyDigest will be available soon for use on public hosted page redirects.

Gateway URLs​

Both gateways are live and will process payments for all Monek merchant accounts. Staging gives early access to new features before they reach the primary platform.

Making a request​

Send a server-to-server HTTP POST to Transact.ashx, with the fields form-encoded (Content-Type: application/x-www-form-urlencoded). The result comes back in the same call. Set ResponseAction=JSON for the most detailed response.

This example refunds £10.00 of an earlier payment, using the CrossReference that payment returned:

POST /Secure/Transact.ashx HTTP/1.1
Host: elite.monek.com
Content-Type: application/x-www-form-urlencoded

MerchantID=0000000&ApiKey=YOUR_API_KEY&Amount=1000&CountryCode=826&CurrencyCode=826&MessageType=REFUND_CNP&Dispatch=NOW&ResponseAction=JSON&ThreeDSAction=NONE&CrossReference=240401101112457459X2R&PaymentReference=REFUND-0001

A ResponseCode of 00 means the transaction succeeded. See Response formats for a full example response, and Response Code Values for the other codes.

Common tasks​

You can try the first four in the demo above.

TaskMessageTypeSendMore
Take a payment, e.g. a phone or mail orderSALE_CNP_TO / SALE_CNP_MOCard detailsRequires PCI DSS accreditation. For payments on your website, use the Checkout Page.
Check a card without charging itVERIFY_CNPCard details, Amount=0No money is taken
Charge a stored card, e.g. a monthly subscriptionESALE_KEYEDCrossReference, CAType, COFInitiatedBy=MERCHANTRecurring Payments
Refund a paymentREFUND_CNPCrossReference of the original payment
Reverse a payment made todayREVERSAL_KEYEDCrossReference of the original paymentSame day only
Settle a payment authorised earlierPAYMENT_ONLY_ prefixCrossReference, AuthorisationCodeDeferred Dispatch

All of these need your ApiKey.

Looking for a field that isn't here?

The full list of every request and response field, and every message type, is in the Field Reference.

  • Idempotency Tokens protect against duplicate transactions if your system retries a request.
  • Webhooks send transaction results straight to your server.
  • Basket Details send itemised basket details, which also meets American Express requirements.

3-D Secure by API​

If the ThreeDSAction field was set and the Transact.ashx has determined that user authentication is required, then an appropriate 3-D Secure response will be returned and must be processed by the merchant. Otherwise a standard Transaction Response will be returned.

tip

In most cases the Checkout Page flow is more appropriate for Ecommerce transactions with 3-D Secure

If the ThreeDSAction field was set to JSON the response fields are sent to the client as JSON in the body of the response e.g.

{
"veResponse": {
"md": "[ENCODEDDATA]",
"enrolled": "Y",
"paReq": "[ENCODEDDATA]",
"acsUrl": "https://3ds2api.monek.com/3ds/acs"
}
}

3-D Secure ACS Response Fields​

If the ThreeDSAction was set to HTMLQS, XML or REDIRECT the response will include the following fields to allow the Web Client to handle the ACS redirection. For example, if the Web Client needs to embed the ACS prompt within a branded web page.

Field NameDescriptionSizeType
ACSURLAccess Control Server URL. Used in redirecting the client browser to the card issuer's 3-D Secure authentication host.VA
MDMerchant Data. All transaction data is retained by the Transact.ashx page. The MD field is used to allow this data to be retrieved and must be included unaltered in the subsequent calls to the ACSURL and TransactACS.ashx.VA
PAReqThe full 3-D Secure request as returned by the card scheme enrolment verification server. This should be passed in its entirety to the issuer's ACS.VA

Redirect to Card Issuer's ACS​

The web client must redirects the cardholder to the 3-D Secure web server at ACSURL by sending the following fields as an HTTP POST request. Note: The ACSURL will not accept transactions redirected using the HTTP GET method.

Field NameDescriptionReq'dSizeType
MDMerchant Data. This field should be passed unaltered from the Transact.ashx response.MVA
PaReqThe full 3-D Secure request. This field should be passed unaltered from the Transact.ashx response.MVA
TermUrlTermination URL. This is the address that the issuer's ACS will call after payer authentication is complete.M50 max.A

The TermUrl field can be used to direct the ACS response back to the Web Client or directly to TransactACS.ashx to complete the transaction.

ACS Response Fields​

If TermUrl is set to direct responses to the merchant web site, then the following fields will be returned. All fields should be forwarded in their entirety and unaltered to TransactACS.ashx to complete the transaction.

Field NameDescriptionReq'dSizeType
MDMerchant Data.MVA
PaResThe full 3-D Secure response as returned by the cardholder's issuer.MVA

If TermUrl is set to direct to TransactACS.ashx then these fields will be passed automatically.