# 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();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.easypay.sa/easypay/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
