Posted on

White-label API Custom Domain Guide

In this tutorial you will learn how to use your own custom domain with our payment gateway API. You will be able to use your own domain instead of api.highriskshop.com and pay.highriskshop.com. You will also be able to optionally insert your affiliate wallet to earn 0.5% on every sale your sub-merchant receive.

You need to make 4 steps:

  1. Your domain name must be using Cloudflare DNS service (free account plan will work fine).
  2. Create a free Cloudflare worker with our JS code to use our API.
  3. Route your domain to use the Cloudflare worker.
  4. Optionally you can insert your affiliate wallet within the code and redistribute our plugins to earn 0.5% on your sub-merchant sales.

Use Cloudflare DNS

  1. Create a free Cloudflare account
  2. Add your domain name to use the free Cloudflare DNS service.
  3. After adding your domain you will be instructed to change your domain’s nameservers (NS) records
  4. Go to your domain registrar where you registered your domain and use the custom nameservers provided in your Cloudflare account. Those nameservers are different for each account.
    Cloudflare Nameservers
  5. After completing the previous steps your domain should be actively using Cloudflare.
  6. Make a proxy (Orange Cloud) DNS A record for every subdomain you want to use with our API. You can add 8.8.8.8 or any other IP address as this record will be proxied to our API anyway. In the following screenshot example we will use api.iptvpay.com and payment.iptvpay.com as custom domains instead of api.highriskshop.com and pay.highriskshop.com
    Cloudflare DNS records
  7. You may need to add a proxied record for every domain/subdomain you want to use as a custom for our API. The IP address doesn’t matter as we will just need this as a route for our worker in the next steps.
    Cloudflare A record

Create a Cloudflare Worker

  1. Go back to your main account page in Cloudflare dashboard.
    Cloudflare dashboard
  2. Visit the Cloudflare workers tab
    Cloudflare workers
  3. Create a new worker after pressing (create application) button.
  4. After creating the worker from its settings edit the code.
    Edit Cloudflare worker code.
  5. You will need to insert our worker.js code into your worker. We offer two versions: standard worker.js will allow you to use your own custom domain without an affiliate wallet injection this will simply allow you to use your custom domain with our API.
    Optionally you can use the affiliate version worker.js which will allow you to use your hidden affiliate USDC (Polygon) wallet to earn 0.5% on every sale that go through your custom domain. Make sure to replace the wallet in the example code with your own USDC wallet to receive earnings.
    White-label API custom domain code
  6. Deploy the code to your Cloudflare worker.js
    The free Cloudflare plan will allow you to use 100,000 request per day with your own custom domain free of charge.

Route Your Custom Domain to The Created Worker

  1. From the newly created worker settings you can set a global custom domain or set a custom route with multiple domains.
  2. Add route for each subdomain you want to set using the wildcard *
    Custom domain API
  3. In the example we are setting api.iptvpay.com/* and payment.iptvpay.com/*
  4. The * wildcard means the domain will work globally for any path of the API.
  5. After completing all the previous steps your domain should work the same way as api.highriskshop.com
  6. You can follow the API Docs for testing.
  7. Using the standard worker.js your domain will work exactly the same as the original API and in case you inserted the affiliate worker.js with your affiliate wallet hidden in the JS code; the parameter affiliate wallet will be added to each request.

Earning Affiliate Commission and White-label Plugins and Modules

  • All our plugins and modules are open-source and available to be modified or re-branded you can visit our GitHub to access all code.
  • You can easily re-brand all  plugins or modules. You can replace all instances of api.highriskshop.com and pay.highriskshop.com within the code with your own custom domain configured in the previous steps.
  • If you want to earn 0.5% commission on every sale made through your sub-merchants ⚠️ you must replace all instances of wallet.php with affiliate.php and you must pass the affiliate parameter to this endpoint per our API Docs/Instructions
  • When you use the affiliate worker.js for your custom domain the affiliate parameter wallet will be added to every request without the need to insert it in the code. This maybe useful to prevent your sub-merchant from removing your wallet or bypass your commission. ⚠️ You still need to use affiliate.php instead of wallet.php.
  • Feel free to contact our support for any questions.