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 a 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.
Make a Pre-authorization
You can initiate a pre-authorization transaction and lock funds from the customer’s card account with the specified amount.
RequestResult r = t.Preauthorization(Amount, cur, txtReference.Text);
Transaction reference is an optional parameter and can be empty or NULL.
Make a Pre-authorization Completion
You can complete a pre-authorization transaction with the customer’s card account with the specified completion amount.
RequestResult r = t.CompletePreauth(strPreauthCode, Amount);
For strPreauthCode you need to use the pre-authorization code of the original pre-authorization transaction.
For Amount, select the amount which you want to take from the client. It can not be a greater number than the Pre-authorized amount from the original transaction.
Make a Pre-authorization Cancellation
You can initiate a cancellation for a pre-authorization transaction.
RequestResult r = t.CancelPreauth(strPreauthCode);
For strPreauthCode you need to use the pre-authorization code of the original pre-authorization transaction.
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);