> For the complete documentation index, see [llms.txt](https://docs.easypay.sa/easypay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.easypay.sa/easypay/quick-start.md).

# Quick Start

## **Before you begin**

Easypay team needs to assigned a demo terminal for you using your phone number to be able to start this integration.\
\
In addition, you need to have an android physical device that supports NFC to be able to test the integration and run the app on it.

## **Start your first transaction:**

### **1- Downland and install the Easypay app form google store** [**Click here to downland**](https://play.google.com/store/apps/details?id=com.easyerps.easypay)**.**

<div align="left" data-full-width="false"><figure><img src="/files/ahPUYtT5o6m684giNohv" alt="" width="563"><figcaption></figcaption></figure></div>

### 2- Login by <mark style="color:blue;">clicking demo button</mark> by <mark style="color:blue;">entering your phone number</mark> and then <mark style="color:blue;">follow the setup instruction</mark>.

<div align="left"><figure><img src="/files/MGxQBaQzLzAC4aWq5aO0" alt="" width="188"><figcaption></figcaption></figure> <figure><img src="/files/seyMBJw6BJahfDOWKsQR" alt="" width="188"><figcaption></figcaption></figure></div>

### 3- on app home screen <mark style="color:blue;">click to Connect</mark> and then <mark style="color:blue;">click Start,</mark> after service starting <mark style="color:blue;">save the IP Address</mark> for later  use and than <mark style="color:blue;">click Running on background</mark>

<div align="left"><figure><img src="/files/xJ7VZtSHmLBOqLthbPkk" alt="" width="188"><figcaption></figcaption></figure> <figure><img src="/files/hcNZZuF3zU58EGK4MiX1" alt="" width="188"><figcaption></figcaption></figure> <figure><img src="/files/DFVZgNQtyt3nX0MTjj7F" alt="" width="188"><figcaption></figcaption></figure></div>

### 4- <mark style="color:blue;">Create WebSocket</mark> **wherever you need:**

```javascript
// Create WebSocket connection.
const socket = new WebSocket("ws://localhost:5000"); // use "localhost" for connection on same device or use "IP address" for connection from external device.

// Connection opened
socket.onopen = () => {
  // connection opened – add action here
});

// Listen for messages
socket.onmessage = (event) => {
  // payload received and message can be fetched on event.data
  // parse JSON message here or add an action
});

// Listen for possible errors
socket.onerror = (event) => {
  // error can be determined on evt.message
});

// Connection opened
socket.onclose = () => {
  // connection closed
});
```

### 5- <mark style="color:blue;">Sending Socket</mark> function:

<pre class="language-javascript"><code class="lang-javascript">socket.send(JSON.stringify({
    "method": "PURCHASE",
    "amount": 100, // [Required] ammount you want to set .
    "customerReferenceNumber": "1234" // [optional] any number you want to add as a refrence Any string as a reference number.
<strong>}));
</strong></code></pre>

### 6- <mark style="color:blue;">Close WebSocket</mark> function:

```javascript
socket.close();
```
