History: Interledger Protocol payments
Preview of version: 8
Interledger Protocol Payments
Interledger Protocol (ILP) payments is a new feature coming in Tiki 24. Interledger is an open and inclusive payments network. The Interledger Protocol is an open protocol suite for sending payments across different ledgers.
How does Interledger Protocol (ILP) work?
The Interledger Protocol is a set of rules that define how nodes should send value over the Interledger network. A single aggregate payment from source to destination is split into multiple ILP packets. Each ILP packet contains transaction information, which is private to the nodes participating in the transaction. The sender constructs and sends a Prepare packet as a request to the connecting router. The routers forward the packet until it reaches the receiver. The receiver then accepts or rejects the packet by sending a Fulfill packet or a Reject packet as the response. The routers relay the response from the receiver back to the sender. When the sender receives a Fulfill packet, it knows that the packet was successfully delivered to the receiver. The sender then continues to send the remaining Prepare packets until the value is fully transferred.
Why use Interledger Protocol (ILP)?
- Simplicity for end-users to transfer value over different networks
- Speed over traditional payment rails
- Reduced cost as competition to connect networks grows and incentivizes lower prices
- Trustworthiness as tracking transactions and all-or-nothing (atomic) transactions guarantee that the value does not get lost due to fees and returns
- Packetizing value — splitting up larger transfers into many lower-value packets which increases the network’s efficiency, security and interoperability
How to do Interledger Protocol (ILP) payments using Tiki?
Explained below is the step by step guide to implement Interledger Protocol (ILP) payments in Tiki assuming there is a working domain already setup, in this example with the following characteristics:
- Domain name
ilp.*
- Path of your home
/home/ilp/
- Username
ilp
- Database name
ilp
- Some strong passwords
Step 1 - Getting and installing a compatible Tiki instance:
At the date of this writing you have to use a specific 24.x version; it will be merged to master soonWe first need to upgrade composer.tiki.org to use Composer v2, which was recently released. and available via Tiki Manager.
Step 2 - Running the ILP moneyd local test network and the ILP SPSP Invoice Server
MoneyD allows you to run an isolated local test network for development. The ILP SPSP is a basic protocol for exchanging payment information between payee and payer to facilitate payment over Interledger. In our case Tiki is the client, that talks to the SPSP server.
a. Navigate one level up your website directory
cd ..
b. Create a directory where we will get the tools and enter it
mkdir ilp-tools && cd ilp-tools
c. Export the path so you can run npm commands as your user
wget https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-x64.tar.gz
tar zxvf node-v14.17.5-linux-x64.tar.gz
export PATH=/home/ilp/ilp-tools/node-v14.17.5-linux-x64/bin:$PATH
d. Install moneyd and the PM2 daemon process manager via npm
npm install moneyd
npm install pm2
e. Finally install the ilp-spsp server
git clone https://github.com/interledgerjs/ilp-spsp-invoice-server.git
cd ilp-spsp-invoice-server
npm install
f. Restore your path and start moneyd and PM2
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
pm2 start "moneyd local"
pm2 start index.js
pm2 status index.js
should print an "online" green status
Step 3 - Setup the Tiki ILP payment feature and a basic cart
Head to your Tiki instance Settings > Control panels and Set as my default the "Advanced" and "Experimental" filters to have all the options available
Navigate to Global setup > Features and activate the Payment feature
In Global setup > Profiles search for Shopping_Cart, click the result, fill Currency initials and Currency symbol as XRP and Apply. You now have a basic shop.
Click on the link near the check button or navigate via the right menu to Miscellanous > Payment and select Inter Ledger Protocol as the Payment system, XRP for Currency, check User can only see own outstanding payments, and User can only see own past or cancelled payments
Bellow fill in the ILP server base url as http://localhost:6000 and the ILP bearer token as test and Apply the settings
Click the Plugins tab, fill Plugin Add to cart, Plugin Member Payment and Plugin Payment
Step 4 - Test an order
Add a product to your cart, click Check-out in the right panel to obtain the ILP pointer for the payment
Copy the link, and back at the command line send 5XRP
ilp-spsp send -a 5 -p http://localhost:6000/0787e2ba-d358-4cb7-901b-8d96350e2887
should respond with amount sent ie "sent 5 units!"
Reload the page or Check Payment and your payment will be confirmed
Related
A special thank you
This work was made possible by a grant from Grant for the Web, a fund to boost open, fair, and inclusive standards and innovation in Web Monetization.