← Home
Marx Payment Gateway

Marx IPG Integration Guide

Welcome to the Marx Internet Payment Gateway (IPG) API Integration Guide. This comprehensive guide provides step-by-step instructions for merchants looking to seamlessly integrate the Marx IPG into their platforms, ensuring secure and efficient online payment processing.

Prerequisites

  • Your KYC details must be verified by our support team.
  • Once verified, you will receive your Merchant API Key.
  • Keep your API Key strictly confidential.
Sandbox URL https://payment.api.dev.marxpos.com/api/v4/ipg/
Production https://payment.v4.api.marx.lk/api/v4/ipg/

Authentication

It is required to send the merchant secret (emailed by Marx upon registration) in the header of every API call.

merchant-api-key: YOUR_SECRET_KEY
Step 1

Creating an order in Marx IPG

The Order Request API allows merchants to create order requests in Marx IPG on behalf of their customers. Upon successful request, Marx IPG provides a payment URL.

POST /orders

Supported Payment Methods

  • OTHER: VISA, MasterCard, UnionPay (LKR)
  • AMEX: American Express, Discover, Diners Club (LKR)
  • OTHER_USD: VISA, MasterCard, UnionPay (USD)
  • AMEX_USD: American Express, Discover, Diners Club (USD)
  • PAY_BY_BANK_ACCOUNT: Direct bank account payment

Request Parameters

Parameter Type Required Description
merchantRIDStringYesUnique reference ID of the order (Cannot be duplicated).
amountDecimalYesAmount of the transaction.
validTimeLimitIntegerYesTime limit of the transaction to proceed (in hours).
returnUrlStringYesUrl of the page to display payment result.
customerMailStringYesMail address of the customer.
customerMobileStringNoMobile no of the customer.
orderSummaryStringYesDescription of the order.
customerReferenceStringYesUnique reference to identify the transaction separately.
paymentMethodStringYesThe chosen payment method string.

Sample Request

{
  "merchantRID": "20231023003",
  "amount": 230.00,
  "validTimeLimit": 2,
  "returnUrl": "https://samplemerchant.com/payment-result.html",
  "customerMail": "[email protected]",
  "customerMobile": "94771234567",
  "orderSummary": "Order Description",
  "customerReference": "James Smith",
  "paymentMethod": "AMEX"
}

Sample Response

{
  "status": 0,
  "message": "SUCCESS",
  "data": {
    "payUrl": "https://ipg.dev.marxpos.com/?tr=5057",
    "trId": 5057,
    "merchantRID": "20231023003"
  },
  "timestamp": "2025-04-08T10:04:15Z"
}
Step 2

Redirect User & 3DS

2.1

Redirect to Payment URL

Extract the payUrl from the response in Step 1. Redirect the user's browser to this URL. The user is prompted to enter their card payment details.

2.2

3DS Authentication Page

The user will be directed to the bank's 3D Secure (3DS) authentication page (usually OTP verification).

Sandbox Note: In the dev environment, use the ACS emulator to simulate responses without real OTPs by selecting the desired outcome from the combo box.
2.3

Redirect Payer To The Merchant Return URL

After completing 3DS authentication, the user is redirected back to your returnUrl specified in Step 1. This URL will include two important query parameters: trId and merchantRID.

https://merchant-return-url?trId=5057&merchantRID=20231023003
Step 3

Check Validity of Query Parameters

To facilitate the initiation of a payment request, merchants are required to perform a validation check on the trId and merchantRID query parameters received in the return URL.

These parameters should be cross-referenced with your previously saved database values. Once validation is successfully completed, you can proceed to trigger the Step 4 request.

Step 4

Initiate the Payment

⚠️ Please Note: The payment amount will ONLY be deducted after this API call is successfully executed.

PUT /orders/{trId}

URL & Request Parameters

ParameterLocationRequiredDescription
trIdURL PathYesValue of the trId returned as a query parameter.
merchantRIDJSON BodyYesMerchant unique reference ID for the order.

Request Body

{
  "merchantRID": "20231023003"
}

Success Response

{
  "status": 0,
  "message": "SUCCESS",
  "data": {
    "summaryResult": "SUCCESS",
    "trId": 5057,
    "merchantRID": "20231023003",
    "gatewayResponse": {
       "order": {
          "status": "CAPTURED",
          "totalCapturedAmount": 230.00
       },
       "response": {
          "gatewayCode": "APPROVED"
       }
    }
  }
}
Step 5

Retrieve Order Summary

The Retrieve Order Summary API is designed to allow merchants to efficiently check the status and summary of their transactions using the unique trId.

GET /orders/{trId}/summary

Response Example

{
  "status": 0,
  "message": "SUCCESS",
  "data": {
    "summaryResult": "SUCCESS",
    "trId": 5057,
    "merchantRID": "20231023003",
    "order": {
      "amount": 230.00,
      "status": "SUCCESS",
      "paymentMethod": "AMEX",
      "customerMail": "[email protected]",
      "validTimeLimit": 2
    }
  }
}

Reference: Response Codes

1. Top-Level Status Codes

0OPERATION SUCCESS
1OPERATION FAILED

2. Summary Results

SUCCESSThe operation was successfully processed.
PENDINGThe operation is currently in progress or pending.
FAILUREThe operation was declined or rejected.
UNKNOWNThe result of the operation is unknown.

3. Gateway Codes

ABORTEDTransaction aborted by payer.
ACQUIRED_SYSTEM_ERRORAcquirer error occurred.
APPROVEDTransaction Approved.
APPROVED_AUTOAutomatically approved by gateway.
APPROVED_PENDING_SETTLEMENTApproved - pending settlement.
AUTHENTICATION_FAILEDPayer authentication failed.
AUTHENTICATION_IN_PROGRESSAuthentication in progress.
BALANCE_AVAILABLEBalance available for point redemption.
BALANCE_UNKNOWNBalance unknown.
BLOCKEDBlocked due to Risk or 3DS rules.
CANCELLEDTransaction cancelled by payer.
DECLINEDRequested operation declined by issuer.
DECLINED_AVSDeclined due to address verification.
DECLINED_AVS_CSCDeclined due to address and CSC.
DECLINED_CSCDeclined due to card security code.
DECLINED_DO_NOT_CONTACTDeclined - do not contact issuer.
DECLINED_INVALID_PINDeclined due to invalid PIN.
DECLINED_PAYMENT_PLANDeclined due to payment plan.
DECLINED_PIN_REQUIREDDeclined due to PIN required.
DEFERRED_TRANSACTION_RECEIVEDDeferred transaction received.
DUPLICATE_BATCHDeclined due to duplicate batch.
EXCEEDED_RETRY_LIMITTransaction retry limit exceeded.
EXPIRED_CARDDeclined due to expired card.
INSUFFICIENT_FUNDSDeclined due to insufficient funds.
INVALID_CSCInvalid card security code.
LOCK_FAILUREOrder locked - transaction in progress.
NOT_ENROLLED_3D_SECURECard holder not enrolled in 3D Secure.