
UPDATED 12/9/2020 because of rebranding to PayString.
Ever since I learned about PayString – the Universal Payment Identifier, I knew I wanted to serve one of my very own using my own domain name. Unfortunately, since PayString is such a new thing, there aren’t too many tutorials guiding me on how to set it up. At least not too many that had domain names using and hosting WordPress.
So what did I do? I did what anyone else would’ve done and asked the online coder-community. Now, my PayString is successfully set up using my own domain name and WordPress site through a “static configuration” (that basically means I’m hosting a couple files that will make my PayString work). I thought others might be interested in configuring their own, too. If you have your own domain and host your own WordPress, then read on on how you can set up your own PayString. But before we begin, what is PayString and why would you want one?
PayString is an open universal payment identifier that makes it easier for people to send and receive money in any currency across any payment network. Any business that sends and receives money can use PayID to give each of their customers a simple and human-readable ID that works across any payment network and makes payments easier with greater network reach.
Think of it as an email address for receiving any type of currency. Got it? Good. Now, let’s get started!
IMPORTANT: modifying any files without prior knowledge of what you are doing can literally break your site. Make the necessary backups just in case anything literally goes down. I am not responsible for anything that gets broken. PROCEED WITH CAUTION!
In this tutorial, we’ll do three (3) things:
1. Modify your .htaccess file
2. Create a new dirextory
3. Create a .json file in the new directory -> enter in your XRP Ledger address and PayString.
In order to modify the files below, you will need to have access to the host Control Panel. If you do not know how to access this, please contact your webhost administrator.
Once you have access to the Control Panel, the next step will be to access the directory where your domain name exists. Most likely, you will find this in the public_html directory. There it will contain all the files for your website.
Once you have located this, you will then need to open up the .htaccess file. .htaccess files provide a way to make configuration changes on a per-directory basis. In this case, allows you to make changes to your WordPress site (.htaccess is sometimes hidden. Be sure to unhide hidden documents so you can view the .htaccess file.)
Select the .htaccess file and click “edit”.
In .htaccess, copy+paste the following code:
# PayID
RewriteEngine On
RewriteBase /
RewriteCond "%{HTTP_ACCEPT}" "application/xrpl-mainnet\+json"
RewriteRule ^(.+) [folder_name]/[filename].json [L]
<FilesMatch "[filename].json">
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, OPTIONS"
Header set Access-Control-Allow-Headers "PayID-Version, application/xrpl-mainnet\+json"
Header set Access-Control-Expose-Headers "PayID-Version, PayID-Server-Version"
Header set Cache-Control "max-age=no-store, public"
</FilesMatch>
Next, you’ll want to Create a folder at the public domain level: ex. paystring (remember the name you gave the folder because that will be the name you insert in the [folder_name] above).
Then, you will go into the newly created folder and create a .js file: ex. paystring.js (you will also need to remember the name you gave the .js file because that will be the name you insert in the [filename] above).
*Be sure to replace [folder_name] and [filename] with the folder and file names you created.
Then, copy+paste the following code:
{
"addresses": [
{
"paymentNetwork": "XRPL",
"environment": "MAINNET",
"addressDetailsType": "CryptoAddressDetails",
"addressDetails": {
"address": "[XRP Ledger Address]"
}
}
],
"payId": "[Custom PAYID]"
}
Important: be sure to enter your own XRPL “address” (and “tag”, if applicable) and the custom PayString you wish to have. For example: send$yourdomain.com.
That’s it! Now, you can check to see if you set it properly by going to PayString Validator and entering in your “PayString”. If it works, CONGRATULATIONS! You just set up your own Static PayString.
Let me know if you have any questions or how it goes in the comments.
Thank you to hammertoe for providing such a detailed tutorial to get me started tinkering with my server and to Freakaz0idberg for helping me reach the finish line – you provided me with the missing info I needed to make PayString work with my domain and WordPress site. You both are 1337!