Handle response result
There is an event that is raised when a response is received from the Traditional myPOS device on a particular request. You should subscribe to the event to get the response result and any response data that is received.
- Define an event handler method
protected void ProcessResult(ProcessingResult r)
{
// handle the response here
if (r.TranData != null)
{
// transaction response
}
}
- Attach your event handler to the event:
public Form1()
{
InitializeComponent();
terminal.ProcessingFinished += ProcessResult;
}
Make a payment
Once initialization and connection to the terminal is completed, you can start using the myPOS Terminal .Net SDK to accept card payments.
RequestResult r = terminal.Purchase(Amount, cur, txtReference.Text);
Transaction reference is an optional parameter and can be empty or NULL.
Make a Refund
You can initiate refund transaction to the customer’s card account with the specified amount.
RequestResult r = terminal.Refund(Amount, cur, txtReference.Text);
Transaction reference is an optional parameter and can be empty or NULL.
Reprint last receipt
With this method the host application could request reprint of the last transaction slip.
RequestResult r = terminal.ReprintReceipt();
Custom receipt print
You can print receipt with your custom data using the following delimiters:
\ - symbol
\n – new line \L – prints logo \l – left alignment \c - center alignment \r - right alignment \W – double width \w – normal width \H – double height \h – normal height
terminal.PrintExternal(txtPrintData.Text);