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, 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. 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 browser extension & mobile application
- Node.js 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. 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:
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://localhost:3001?recipient=Your+Merchant+Address&label=Your+Store+Name
Next, open the phantom wallet browser extension and change network settings to Devnet (this will serve as our merchant wallet)
Copy the wallet address and edit it into the recipient section of the point-of-sale address.
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:
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)
Copy the wallet address by clicking on the top part of the application
Next, head over to Solfaucet, input your wallet address and an amount of 2 SOL, then select Devnet so Solfaucet can fund your wallet with SOL
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
Next, head back to the customer wallet and click the barcode reader button on the top right of the application.
Go back to the point-of-sale, use your phone to scan the generated payment code, and hit send.
Congratulations, you have successfully made a crypto payment in SOL via Solana Pay’s Point of Sale system.
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.
Top comments (1)
How can one transfer SOL or USDC from one account (wallet of merchant M1) to a wallet/POS of another merchant M2 programatically (without any Phantom app or like)?