History: Interledger Protocol payments
Source of version: 11 (current)
Copy to clipboard
{syntax type="markdown" editor="wysiwyg"} # Interledger Protocol Payments [https://interledger.org/|Interledger Protocol (ILP)] payments is a new feature coming in ((Tiki24|Tiki 24)). Interledger is an open and inclusive payments network which **does not utilize a blockchain**. The Interledger Protocol is an open protocol suite for sending payments across different ledgers. ## How does Interledger Protocol (ILP) work? The [https://interledger.org/rfcs/0027-interledger-protocol-4/|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. You can read the [https://interledger.org/uploads/interledger.pdf|whitepaper here]. ## 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 [https://gitlab.com/tikiwiki/tiki/-/merge_requests/837|specific 24.x version]; it will be merged to master {MOUSEOVER(label="soon")}We first need to upgrade composer.tiki.org to use Composer v2, which was recently released. {MOUSEOVER} and available via Tiki ((Manager)). ### **Step 2 - Running the ILP moneyd local test network and the ILP SPSP Invoice Server** [https://github.com/interledgerjs/moneyd|MoneyD] allows you to run an isolated local test network for development. The [https://github.com/interledgerjs/ilp-spsp-server|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 {img src="display1775" link="display1775" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} ### **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 {img src="display1776" link="display1776" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} Navigate to **Global setup** > **Features** and activate the **Payment** feature {img src="display1777" link="display1777" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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. {img src="display1778" link="display1778" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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** {img src="display1779" link="display1779" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} Bellow fill in the **ILP server base url** as http://localhost:6000 and the **ILP bearer token** as test and **Apply** the settings {img src="display1780" link="display1780" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} Click the Plugins tab, fill **Plugin Add to cart**, **Plugin Member Payment** and **Plugin Payment** {img src="display1781" link="display1781" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} ### **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 {img src="display1782" link="display1782" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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 {img src="display1783" link="display1783" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} ## Related - ((Web Monetization)) - ((PluginCoil)) ## A special thank you This work was made possible by a grant from [https://www.grantfortheweb.org/|Grant for the Web], a fund to boost open, fair, and inclusive standards and innovation in Web Monetization. - https://community.webmonetization.org/tikiilp/tiki-ilp-integration-and-monetization-final-grant-report-9ge - https://community.webmonetization.org/tikiilp/tiki-ilp-integration-and-monetization-grant-report-1-2b4a