# Serial Connection Best Practice

Here is the quick debug steps that you might want use an serial connection from your Point of Sale machine or Vending Machine or PC.

{% stepper %}
{% step %}

### Install Payment Apps

Option 1: Install Payment Apps, apps can be installed through ADB, or push by TMS.

{% embed url="<https://ftp.wizarpos.com/payment/OPC_V1.7.0-global-release.apk>" %}

{% embed url="<https://ftp.wizarpos.com/payment/PayWizard_Demo_V2.0.0_2508081.apk>" %}

Option 2: Our tech support team also can help you to download these apk to your terminal.
{% endstep %}

{% step %}

### Set Protocal Type to Serial  or  TMS Push Para to terminal

Option 1: Set terminal connection protocal type to **Serial** in Payment app, refer to PaymentInterfaceAppUserGuide.pdf

{% file src="<https://2631785516-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY7FuzH91SaNfvhwFA9Ic%2Fuploads%2FnkmPX31oU8SowcD1VXUz%2FPaymentInterfaceAppUserGuide.pdf?alt=media&token=04fa0569-9838-41d0-94c2-fdd364e7729b>" %}

Option 2: Our tech support team also can help you to push parameter to your terminal to modify this settings.
{% endstep %}

{% step %}

### Connect Payment Terminal to PC/Android Device/Point of Sale machine

With serial cable or usb cable that support serial protocal
{% endstep %}

{% step %}

### Start serial port debug tool in your PC/Android Device/Point of Sale&#x20;

Example:

<figure><img src="https://2631785516-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY7FuzH91SaNfvhwFA9Ic%2Fuploads%2F2WoidouMw96azkU0UeC2%2Fimage.png?alt=media&#x26;token=02ba7e11-ea8c-4f75-8771-f6dd26d5e3f8" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Send handshake command data through by serial port tool

Here is sample request message.&#x20;

{% code title="HandShake" overflow="wrap" %}

```
req:0202F10004620004313233340396
```

{% endcode %}
{% endstep %}

{% step %}

### Send Transaction command data through by serial port tool

Here is some sample request message.

{% code title="Transaction Request" overflow="wrap" %}

```asciidoc
req:02020100007B00A57B225472616E7354797065223A225075726368617365222C225472616E73416D6F756E74223A223132333435222C2243757272656E6379436F6465223A2230383432222C225265715472616E7344617465223A22313231313130222C225265715472616E7354696D65223A22313335343535222C22456E61626C6552656365697074223A747275652C22536B6970436F6E6669726D50726F636564757265223A747275657D03AB
```

{% endcode %}

{% code title="PrintLast " overflow="wrap" %}

```
req:02020100007B004C7B225472616E7354797065223A225072696E744C617374222C22456E61626C6552656365697074223A66616C73652C22536B6970436F6E6669726D50726F636564757265223A66616C73657D0351
```

{% endcode %}

{% code title="Reversal " overflow="wrap" %}

```
req:02020100007B00617B225472616E7354797065223A22526576657273616C222C224F72695472616E734964223A22313233343536222C22456E61626C6552656365697074223A66616C73652C22536B6970436F6E6669726D50726F636564757265223A66616C73657D031D
```

{% endcode %}

{% code title="Refund " overflow="wrap" %}

```
req:02020100007B00747B225472616E7354797065223A22526566756E64222C225472616E73416D6F756E74223A2231303030222C224F72695472616E734964223A22313233343536222C22456E61626C6552656365697074223A66616C73652C22536B6970436F6E6669726D50726F636564757265223A66616C73657D036F
```

{% endcode %}

{% code title="Cancel Request" overflow="wrap" %}

```
req:0202C1000001000003C1
```

{% endcode %}
{% endstep %}
{% endstepper %}

## For Serial / Socket Connection, you will need to follow&#x20;

{% content-ref url="payment-app-integration-protocol" %}
[payment-app-integration-protocol](https://smartpossdk.gitbook.io/paywizard-open-api/semi-integration/local-integration/payment-app-integration-protocol)
{% endcontent-ref %}

## Here is some develop reference

Suitable for scenarios where no application development on the POS terminal is needed. Instead, the Vendor Machine communicates directly with the Payment App. In this case, communication between the POS terminal and the Vendor Machine supports serial port, MDB (Multi-Drop Bus), and Socket protocols.

Reference for data packaging and unpacking of VM：

{% embed url="<https://ftp.wizarpos.com/advanceSDK/PaymentApp/Serial&SocketDemo240910.zip>" %}

## Here is an common quick debug video.

{% embed url="<https://youtube.com/shorts/msB1yNQAW4s?feature=share>" fullWidth="false" %}
