MOAMALAT GATEWAY - DATA SERVICE
This section details how to integrate with Moamalat via API interface to retrieve transaction data Message Definition The web service takes a JSON request to search on transaction log.
API URL:
- Test: https://tnpg.moamalat.net/cube/paylink.svc/api/FilterTransactions
- Production: https://npg.moamalat.net/cube/paylink.svc/api/FilterTransactions
REQUEST MESSAGE FORMAT
Item | Data Type | Leanght | Optional/ Mandatory | Comments |
---|---|---|---|---|
MerchantReference | String | 10-36 | O | Merchant Reference for the transaction. |
NetworkReference | String | 10-36 | O | payment gateway reference number in case of card transactions. |
TerminalId | String | 6-8 | M | The Moamalat terminal ID. |
MerchantId | String | 11-18 | M | Moamalat Merchant Id applied the transaction. |
DisplayLength | String | 1-5 | M | Number of Transactions required to be returned for the request. |
DisplayStart | String | 1-5 | M | The index to start fetch data from. |
DateTimeLocalTrxn | String | 12 | M | The request execution date and time with format “YYMMDDHHMMSS” and it should be unique per terminal requests. |
DateFrom | String | 12 | O | The transaction execution date and time with format “yyyyMMdd” to start search from. |
DateTo | String | 12 | O | The transaction execution date and time with format “yyyyMMdd” to end search to. |
SortCol | String | 1-25 | O | The column name you want to sort data with. |
SortDir | String | 1-25 | O | The Sort direction either “asc” or “desc”. |
SecureHash | String | 20-250 | O | A keyed hash message authorization code (HMAC) is a specific type of message authorization code (MAC) involving a cryptographic hash function and a secret cryptographic key. It is used to verify both the data integrity and the authorization of a message. |
Request Example
ts
{
"MerchantReference":"MR123EF278",
"TerminalId":"84949616",
"MerchantId":"45374",
"DisplayLength":"1",
"DisplayStart":"0",
"DateTimeLocalTrxn":"181142172106",
"SecureHash":"F69E47CE228EA038034B71647DF069
01BA36CD19F639D5CAE4AB4CA5D2D93014"
}
Response Message Formats
Item | Data Type | Leanght | Comments |
---|---|---|---|
Message | String | 0-250 | The message describes the transaction execution status. |
Success | Boolean | 4-5 | Describe transaction execution status. |
Transactions | The array of transactions returned from applying search parameters. | ||
CardNo | String | 10-16 | The card number executed the transaction. |
DisplayLength | String | 1-5 | Number of Transactions required to be returned for the request. |
DisplayStart | String | 1-5 | The index to start fetch data from. |
MobileNumber | Integer | 12-14 | The mobile number in case this is a Wallet transaction. |
Amnt | String | 1-15 | The transaction amount in smallest currency unit. |
Status | String | 1-25 | “Approved” if the transaction executed successfully. |
Currency | String | 3-3 | The Transaction Currency shall conform to [ISO 4217] and shall contain the 3-digit numeric representation of the currency. For example, LYD is represented by the value "434". |
TransType | String | 1-25 | The transaction type. |
CardType | String | 1-25 | The card type. |
STAN | String | 1-14 | The system trace number. |
RRN | String | 12-36 | Retrieval reference number returned by the payment gateway. |
MerchantReference | String | 0-300 | Merchant Reference for this transaction. |
CardReceiptNoType | String | 12-14 | The receipt number returned by the payment gateway. |
TotalCountAllTransaction | Integer | 1-10 | The total count of returned transactions from search result. |
Response Example
ts
{
"Message": null,
"Success": true, "TotalCountAllTransaction": 1,
"Transactions": [
{
"Date": "18/11/2018",
"DateTotalAmount": "154",
"DateTransactions": [
{
"Amnt": "77",
"AmountTrxn": "77",
"CardNo": "400000XXXXXX0002",
"CardType": "VISA",
"Currency": "EGP",
"ExternalTxnId": null,
"FeeAmnt": "0",
"IsRefundEnabled": true,
"IsSend": false,
"MerchantReference": "Merchant_REF",
"MobileNumber": null,
"RRN": "1100053340",
"ReceiptNo": "832302529385",
"ResCodeDesc": "Approved",
"STAN": "878561",
"SenderName": null,
"Status": "Approved",
"TipAmnt": "0",
"TransType": "Sale",
"TransactionChannel": "Card",
"TransactionId": "65324",
"TxnDateTime": "18/11/18 17:15"
} ]
} ]
}
DATA SERVICE API SECURE HASH
The SHA-256 HMAC is calculated as follows:
- The SHA-256 HMAC calculation includes these fields:
- DateTimeLocalTrxn
- MerchantId
- TerminalId
- The field names are sorted in ascending of parameter name as listed above.
- Construct a string by concatenating the string form of the sorted field name-value pairs. The string form of a name-value pair is the name followed by the value.
- The field name and the value in each field name-value pair are joined using "=" as the separator.
- The resulting joined field name-value pairs are themselves joined using "&" as the separator.
- Create a SHA-256 HMAC of the resultant string using the hex decoded value of merchant secret key given by MOAMALAT integration consultant as the key.
- Encode the HMAC in hexadecimal convert it to uppercase and populate it in the request as the value for the SecureHash field that will be added to the request.
Example:
Using the following merchant secret key: 34376635346431302D353564662D346334652D623965302D656239653030306637323161
Using the following parameters: DateTimeLocalTrxn=1811101423&MerchantId=45374&TerminalId=84949616
The resulting secure hash will be: CF0B9237DCC8D31F985B6203BDBA634019717D746BAA1B8C7F198BA3DA0B6A96
Use the following LINK with correct parameters are set: