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.
Authentication
It is required to send the merchant secret (emailed by Marx upon registration) in the header of every API call.
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.
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 |
|---|---|---|---|
| merchantRID | String | Yes | Unique reference ID of the order (Cannot be duplicated). |
| amount | Decimal | Yes | Amount of the transaction. |
| validTimeLimit | Integer | Yes | Time limit of the transaction to proceed (in hours). |
| returnUrl | String | Yes | Url of the page to display payment result. |
| customerMail | String | Yes | Mail address of the customer. |
| customerMobile | String | No | Mobile no of the customer. |
| orderSummary | String | Yes | Description of the order. |
| customerReference | String | Yes | Unique reference to identify the transaction separately. |
| paymentMethod | String | Yes | The 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"
}
Redirect User & 3DS
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.
3DS Authentication Page
The user will be directed to the bank's 3D Secure (3DS) authentication page (usually OTP verification).
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
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.
Initiate the Payment
⚠️ Please Note: The payment amount will ONLY be deducted after this API call is successfully executed.
URL & Request Parameters
| Parameter | Location | Required | Description |
|---|---|---|---|
| trId | URL Path | Yes | Value of the trId returned as a query parameter. |
| merchantRID | JSON Body | Yes | Merchant 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"
}
}
}
}
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.
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
| 0 | OPERATION SUCCESS |
| 1 | OPERATION FAILED |
2. Summary Results
| SUCCESS | The operation was successfully processed. |
| PENDING | The operation is currently in progress or pending. |
| FAILURE | The operation was declined or rejected. |
| UNKNOWN | The result of the operation is unknown. |
3. Gateway Codes
| ABORTED | Transaction aborted by payer. |
| ACQUIRED_SYSTEM_ERROR | Acquirer error occurred. |
| APPROVED | Transaction Approved. |
| APPROVED_AUTO | Automatically approved by gateway. |
| APPROVED_PENDING_SETTLEMENT | Approved - pending settlement. |
| AUTHENTICATION_FAILED | Payer authentication failed. |
| AUTHENTICATION_IN_PROGRESS | Authentication in progress. |
| BALANCE_AVAILABLE | Balance available for point redemption. |
| BALANCE_UNKNOWN | Balance unknown. |
| BLOCKED | Blocked due to Risk or 3DS rules. |
| CANCELLED | Transaction cancelled by payer. |
| DECLINED | Requested operation declined by issuer. |
| DECLINED_AVS | Declined due to address verification. |
| DECLINED_AVS_CSC | Declined due to address and CSC. |
| DECLINED_CSC | Declined due to card security code. |
| DECLINED_DO_NOT_CONTACT | Declined - do not contact issuer. |
| DECLINED_INVALID_PIN | Declined due to invalid PIN. |
| DECLINED_PAYMENT_PLAN | Declined due to payment plan. |
| DECLINED_PIN_REQUIRED | Declined due to PIN required. |
| DEFERRED_TRANSACTION_RECEIVED | Deferred transaction received. |
| DUPLICATE_BATCH | Declined due to duplicate batch. |
| EXCEEDED_RETRY_LIMIT | Transaction retry limit exceeded. |
| EXPIRED_CARD | Declined due to expired card. |
| INSUFFICIENT_FUNDS | Declined due to insufficient funds. |
| INVALID_CSC | Invalid card security code. |
| LOCK_FAILURE | Order locked - transaction in progress. |
| NOT_ENROLLED_3D_SECURE | Card holder not enrolled in 3D Secure. |