A simple guide on how to set up Solana Pay's POS system on Devnet
Tags: blockchain, beginners, writing, web3
Published: 2022-05-19 14:58:47

## Introduction
The blockchain ecosystem is expanding, as is one of its most essential concepts, DeFi (Decentralized Finance). This concept uses the blockchain's capabilities to provide financial services such as investments, loans, savings, and payments for products and services without using financial institutions or intermediaries. 

Crypto payments are gaining popularity worldwide because they enable near-instant cross-border transfers, as opposed to the traditional banking system, which is riddled with restrictions and limitations that vary by region. This article will go over how to set up Solana Pay's point of sale system on the Devnet server to accept payments in the blockchain's native asset (SOL).

## What is Solana Pay and how does it work?
Solana Pay is a payment platform that uses the Solana blockchain's scalability to provide businesses and customers with lightning-fast and low-cost transactions. As a decentralized digital payment platform, it gives users access to transaction records, wallet addresses, transaction amounts, and currency types but keeps the information hidden from the network. It accepts SOL (Solana's native token) and other tokens issued on the blockchain, such as USDC, as payment.

Developers can easily incorporate it into their (Dapps) Decentralized applications. An example of this is [PocketPay](https://pocketpay.finance/), a POS wallet with Solana Pay integrated into it, and merchants can accept it as a form of payment to customers using Solana-based wallets like Phantom. It also brings other interesting smart contract functionalities into business transactions by allowing customers to get items at a discounted price using an [NFT as loyalty points](https://www.youtube.com/watch?v=5uABl49jknk). This will enable businesses to accept crypto payments regardless of their location.

## Prerequisites
To follow and understand this tutorial, you will need the following:

- A text editor or IDE (preferably vscode)
- [Phantom wallet](https://phantom.app) browser extension & mobile application
- [Node.js](https://nodejs.org/en/) installed on your machine

## Getting Started
We will set up the Pos system on the Devnet server. The Devnet server is only available for local development and is hosted on your local machine. It enables testing and experimenting without affecting real assets.

Commencing this tutorial will require us to clone Solana pay’s [Github repository](https://github.com/solana-labs/solana-pay). You can choose to download it as a zip file from the official repository or run the command below in a terminal on vscode:

```
git clone https://github.com/solana-labs/solana-pay.git
```
After cloning the repository, run the command below to change the terminal directory to the project directory:

```
cd point-of-sale
```
### Install dependencies 
The next step is to install dependencies, run the command below in a terminal in order to do so:

```
yarn install
```
### Set up your local development server
With the necessary packages now fully installed with the aid of `yarn`, we will be setting up our development server. Run the command below:
```
yarn dev
```

Once successful, open the local server in your browser and confirm it’s running. You should see something similar to this:


![Solana Pay local host](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fkzzvrz63ltu0m8v7e8m.png)

### Set up your local client server 
The next step is to set up a client server, open up a new terminal (remember to change directory to `point-of-sale`) and run the following code:

```
yarn proxy
```
### Set up the merchant wallet address  
Copy the point of sale address below into your note editor. You can get this directly from [Solana Pay’s Pos repository](https://github.com/solana-labs/solana-pay/tree/master/point-of-sale).

```
https://localhost:3001?recipient=Your+Merchant+Address&label=Your+Store+Name
```

![Note](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgzugb8op21cun94fzm0.png)
Next, open the phantom wallet browser extension and change network settings to Devnet (this will serve as our merchant wallet)

![Phantom wallet address](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c712n8gcu6xlj0cw4vs4.png)

![Phantom wallet address2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1b8t7us7bpxu9xn8ascs.png)
Copy the wallet address and edit it into the recipient section of the point-of-sale address.

![note2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tucraiqpv1k53p8jjeko.png)
Copy the edited point-of-sale from your note editor and paste it into a new tab in your browser. It should look like this:

![solana point of sale in browser](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udji3x67hkkclc0dp24j.png)
### Set up and funding the customer wallet 
To make payment to a merchant address, we need a customer wallet. This is where the phantom wallet on your phone comes in.

Open the phantom wallet on your phone and change the network settings to Devnet (this will serve as our customer wallet)

![Pwallet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtu9sjtrubp3th0ywj9t.png)
Copy the wallet address by clicking on the top part of the application

![Pwallet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fml58f3sl3o2o5bdf3bs.png)

Next, head over to [Solfaucet](https://solfaucet.com/), input your wallet address and an amount of 2 SOL, then select Devnet so Solfaucet can fund your wallet with SOL

![Solfaucet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oykj8mndoq20xibl4uc2.png)

### Making payment to the merchant with the customer wallet  
Now that we have a client wallet funded with SOL, we can easily make payments to the merchant. 

Head back to your browser and navigate to the point-of-sale tab. Input an amount and generate a Payment code

![Solana Pay's Pos code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgob9ztnwcpinz6nvxty.png)

Next, head back to the customer wallet and click the barcode reader button on the top right of the application.
![Phantom wallet barcode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzyq50air0rvt5gnfufz.png)
Go back to the point-of-sale, use your phone to scan the generated payment code, and hit send.
![payment code scan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttb9h3mv7rmm5m8nxiwk.png)
![payment code send](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ayw49yqd33om52iska7b.png)
Congratulations, you have successfully made a crypto payment in SOL via Solana Pay’s Point of Sale system.

![congratulations1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qewzabikpanrqykgr7a7.png)

![congratulations2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v7yp62by4a5darnk0rea.png)
## Conclusion
In this article, you learnt about the importance of crypto payments and the leverage it has over the traditional banking systems, what Solana Pay is, and how to set up and perform transactions on its Point of Sale system on Devnet.