Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Moniepoint Communication Library provides a C# implementation for seamless communication with Moniepoint payment terminals through a serial port. This library facilitates developers in interacting with Moniepoint devices by enabling the sending of payment requests and checking the connection status.

ea5-Ez8Ze1lGq57Mw2sPT4ztDZ7bQhxoblZr_OLbXYL4Gdfv4TxU1rCZHjVhUabvfU2Hlr_dLCGBk2bxaacpkexhVa_FpmS8mXKgmONoejtp_p5wAy0BvqcNNKV54CfH9YUfC1wc2w9Yg5GsMR3ojms (1).jpgImage Added

DLL Name

The DLL associated with the Moniepoint Communication Library is named moniepoint.dll

You need the DLL file to enable communication

Constructor 

public MoniepointCommunicationService(string portName, int baudRate, int timeoutMilliseconds)

...

Returns the version of the Moniepoint Communication Library.

...

2. CheckConnection()

Checks the connection status with the Moniepoint payment terminal.

PaymentSendAndReceive(out response, transactionRequest)

Sends a payment request to the Moniepoint payment terminal and get response.

Usage Example

Code Block
languagec#
using System;
using MoniepointLibrary;

namespace MoniepointApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string response;

            try
            {
                string portName = "COM1";
                int baudRate = 115200;
                int timeoutMilliseconds = 90000; //90 seconds

                using (var moniepointServicecommunicationService = new MoniepointCommunicationService("COM1"portName, 9600baudRate, 5000timeoutMilliseconds))
                {
    if (moniepointService.CheckConnection())
    {
        var paymentRequest
                    var transactionRequest = new PaymentRequest
        {
            TransactionType
                    {
                        TransactionType = "Sale1",
            Amount
                        Amount = "100.00",
            MerchantReference
                        MerchantReference = "123456ABC123"
        };

        var paymentResponse = moniepointService.SendPaymentRequest(paymentRequest);
        if (paymentResponse.Status == "success")
        {
            var responseData = paymentResponse.ResponseData;
            var responseObject = paymentResponse.ResponseDataObject as Response;
        }
        else
        {
            // Handle error or timeout
        }
    }
}                    };

                    int paymentStatus = communicationService.PaymentSendAndReceive(out response, transactionRequest);

                    if (paymentStatus == MoniepointCommunicationService.SuccessStatus)
                    {
                        Console.WriteLine("Payment Response Data: " + response);
                    }
                    else
                    {
                        Console.WriteLine("Error code: {0}, description: {1}", paymentStatus, communicationService.GetErrorMessage(paymentStatus));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }

            Console.WriteLine("Press Enter to exit...");
        }
    }
}

Transaction Type

1 - Credit Card Purchase

...

96 - System malfunction

98 - Exceeds cash limit

Response Class

The Response class represents the response data structure received from the Moniepoint payment terminal.

...

Sample Response - POS Transfer

Code Block
<?xml
version="1.0"?>
<Response>
    <MaskedPan>null</MaskedPan>
    <ResponseCode>00</ResponseCode>
    <AuthorizeCode>null</AuthorizeCode>
    <CardHolderName>null</CardHolderName>
    <Amount>10000</Amount>
    <RetrievalRefNo>null</RetrievalRefNo>
    <TerminallD>2214YY0M
    </TerminalID>
    <TransTime>2024-09-27T00:24:31.000000000</TransTime>
    <PaymentMethod>POS_TRANSFER</PaymentMethod>
    <CardScheme>null</CardScheme>
</Response>

Sample Response - Card Payment

Code Block
<?xml version="1.0"?> 
<Response>
<MaskedPan>512345******1230</MaskedPan>
<ResponseCode>00</ResponseCode>
<AuthorizeCode>1B7D</AuthorizeCode>
<CardHolderName>CUSTOMER/ZENITH</CardHolderName>
<Amount>10000</Amount>
<RetrievalRefNo>000000000007</RetrievalRefNo>
<TerminalID></TerminalID>
<TransTime>2023-09-11T17:07:33.000000000</TransTime>
<PaymentMethod>CARD_PURCHASE</PaymentMethod>
<CardScheme>MASTERCARD</CardScheme>
</Response>

Error codes

Code Block
languagec#
 public const int SuccessStatus = 0;
 public const int PortNotOpenStatus = -1;
 public const int SendErrorStatus = -2;
 public const int ReceiveErrorStatus = -3;
 public const int ReceiveTimeoutStatus = -4;
        public const int InvalidResponseLengthStatus = -5;
        public const int InvalidAcknowledgeResponseStatus = -6;
        public const int InvalidConnectionStatusResponse = -7;
        public const int  ReceiveConnectionErrorStatus = -8;
        public const int ReceiveTimeoutStatusWithPartialResponse = -9;

 Contact Support

pos-integrations@moniepoint.com