DEV Community

Cover image for Static Serving PayID Addresses
Matt Hamilton
Matt Hamilton

Posted on • Updated on

Static Serving PayID Addresses

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$ 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:

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$ is rewritten to an HTTPS request to 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>
    DocumentRoot "/var/www/htdocs/"

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

    SSLEngine on
    SSLProtocol All -SSLv2 -SSLv3
    SSLHonorCipherOrder On
    SSLSessionTickets Off

    SSLCertificateFile "/etc/letsencrypt/live/"
    SSLCertificateKeyFile "/etc/letsencrypt/live/"

    ErrorDocument 404 /404.html

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

Enter fullscreen mode Exit fullscreen mode

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/ that contains:

  "addresses": [
      "paymentNetwork": "XRPL",
      "environment": "MAINNET",
      "addressDetailsType": "CryptoAddressDetails",
      "addressDetails": {
        "address": "X75nEw5QD8Ej8jWt7EkJXHoVAV9YCtjuUSJppADpNtPKdim"
  "payId": "matt$"
Enter fullscreen mode Exit fullscreen mode

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

Top comments (6)

guykatz profile image

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)...

freakaz0idberg profile image

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.

hammertoe profile image
Matt Hamilton

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.

ronpimplebut profile image

is it works on raspberry pi 4?

besmily profile image

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

besmily profile image

le systeme xumm est possible sur htpps?