loading...
Cover image for Static Serving PayID Addresses

Static Serving PayID Addresses

hammertoe profile image Matt Hamilton Updated on ・3 min read

PayID (2 Part Series)

1) Static Serving PayID Addresses 2) Hosting a PayID on Github Pages

What is PayID?

So you heard the great news about PayID? It is a universal payment identified to be used with both traditional banking and cryptocurrency accounts to provide a simple, easy to use ID for payments.

It was launched today, and quite a lot of coverage about it:

Want to pay me? My PayID is matt$quernus.co.uk. Is that a bank? XRP? Bitcoin? Who knows? Who cares! But you can pay me by sending a payment to that ID. And the great thing is that it is backed by a whole load of companies.

Setting up PayID

There are some great instructions for setting up a PayID server here: https://docs.payid.org/

But! What if you don't want to run a server to do it? What if you just want to statically configure an entry or two and you happen to run your own server and have your own domain?

Here is how to setup a PayID on an Apache server to serve up a simple static PayID file. In this case directing to an XRP wallet.

The convention for the lookup is that matt$quernus.co.uk is rewritten to an HTTPS request to https://quernus.co.uk/matt ie. the local part before the $ is put in the end as the path.

First: You need to configure Apache. I'll include the full virtualhost directive below for completeness, but the PayID bit is just the last 3 lines below the comment.

<VirtualHost [2001:41c8:11a:5::1]:443 46.43.0.47:443>
    ServerName www.quernus.co.uk
    ServerAlias quernus.co.uk
    DocumentRoot "/var/www/htdocs/www.quernus.co.uk/"

    Header always set Strict-Transport-Security "max-age=63072000; preload"

    SSLEngine on
    SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
    SSLProtocol All -SSLv2 -SSLv3
    SSLHonorCipherOrder On
    SSLSessionTickets Off

    SSLCertificateFile "/etc/letsencrypt/live/www.quernus.co.uk/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/www.quernus.co.uk/privkey.pem"

    ErrorDocument 404 /404.html

    # PayID
    RewriteEngine On
    RewriteCond "%{HTTP_ACCEPT}" "application/xrpl-mainnet\+json"
    RewriteRule ^(.+) /.pay/$1.json [L]

</VirtualHost>

The first list turn Apache's rewrite engine on. You may already have this. The second line is a rewrite condition that means it will only catch requests with a specific accept request HTTP header. The last line is the actual rewrite rule and will fetch the requested file with .json on the end.

So I then have a file /var/www/htdocs/www.quernus.co.uk/.pay/matt.json that contains:

{
  "addresses": [
    {
      "paymentNetwork": "XRPL",
      "environment": "MAINNET",
      "addressDetailsType": "CryptoAddressDetails",
      "addressDetails": {
        "address": "X75nEw5QD8Ej8jWt7EkJXHoVAV9YCtjuUSJppADpNtPKdim"
      }
    }
  ],
  "payId": "matt$quernus.co.uk"
}

You can look up the full format of this file in the PayID docs site above, but in short the above details an XRP account on the mainnet of the XRP Ledger.

Demo of PayID in Xumm

Below is a demo of this excellent wallet Xumm, one of the first to support PayID, looking up the PayID setup above.

Screencast of Xumm looking up a PayID

PayID (2 Part Series)

1) Static Serving PayID Addresses 2) Hosting a PayID on Github Pages

Posted on by:

hammertoe profile

Matt Hamilton

@hammertoe

Software developer. Developer Advocate at @IBMDeveloper. Tinkerer of motorbikes, vans, Arduinos, etc.

Discussion

markdown guide
 

is there a big enogh company that I can get a payid from right now?
for example, google controls the email market. I am looking for the company that will potentialy control the payid market to sign up and get my payid from (names will be taken very fast)...

 

hey Matt, thanks for the tutorial :-) I‘ve set up all, but xumm doesnt recognice my payID. How can i test it? Is there an API testtool where i can put my websitepath in or something? Maybe my rewriterule doesnt work.

 

Hi! Glad you found it useful. I'm not aware of any testing tools, but that certainly would be a useful thing. I am thinking I might try and make one if I can.

 

quel développeur serait compétent pour l'integrer sur mon site web?

 

le systeme xumm est possible sur htpps?