Skip to content

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:

REQUEST MESSAGE FORMAT

ItemData TypeLeanghtOptional/ MandatoryComments
MerchantReferenceString10-36OMerchant Reference for the transaction.
NetworkReferenceString10-36Opayment gateway reference number in case of card transactions.
TerminalIdString6-8MThe Moamalat terminal ID.
MerchantIdString11-18MMoamalat Merchant Id applied the transaction.
DisplayLengthString1-5MNumber of Transactions required to be returned for the request.
DisplayStartString1-5MThe index to start fetch data from.
DateTimeLocalTrxnString12MThe request execution date and time with format “YYMMDDHHMMSS” and it should be unique per terminal requests.
DateFromString12OThe transaction execution date and time with format “yyyyMMdd” to start search from.
DateToString12OThe transaction execution date and time with format “yyyyMMdd” to end search to.
SortColString1-25OThe column name you want to sort data with.
SortDirString1-25OThe Sort direction either “asc” or “desc”.
SecureHashString20-250OA 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

ItemData TypeLeanghtComments
MessageString0-250The message describes the transaction execution status.
SuccessBoolean4-5Describe transaction execution status.
TransactionsThe array of transactions returned from applying search parameters.
CardNoString10-16The card number executed the transaction.
DisplayLengthString1-5Number of Transactions required to be returned for the request.
DisplayStartString1-5The index to start fetch data from.
MobileNumberInteger12-14The mobile number in case this is a Wallet transaction.
AmntString1-15The transaction amount in smallest currency unit.
StatusString1-25“Approved” if the transaction executed successfully.
CurrencyString3-3The 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".
TransTypeString1-25The transaction type.
CardTypeString1-25The card type.
STANString1-14The system trace number.
RRNString12-36Retrieval reference number returned by the payment gateway.
MerchantReferenceString0-300Merchant Reference for this transaction.
CardReceiptNoTypeString12-14The receipt number returned by the payment gateway.
TotalCountAllTransactionInteger1-10The 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:

  1. The SHA-256 HMAC calculation includes these fields:
  • DateTimeLocalTrxn
  • MerchantId
  • TerminalId
  1. The field names are sorted in ascending of parameter name as listed above.
  2. 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.
  1. 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.
  2. 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:

Alt text

DEMO FETCH