Following on from our guide on using Payhere with Wix – if you want to embed your payment links and provide a more seamless integration, you can add our Wix embed code in order to keep the customers on your website and have the payment links pop up in a modal.

First, you’ll need to follow our Wix guide to link up your payment buttons, and once your done, come back here and follow along to add the additional embed code, this will allow you to have Wix subscription payments built directly into your website!

Next you’ll want add our embed code, you will need to be on a pro plan on Wix – this will work on the Core package and above.

1. First you’ll want to select the 'Add element' button on the right hand menu in the Wix editor
2. Then choose 'Embed code', and 'Marketing tools', and finally click the 'Custom Code' element.
3. Next you’ll see a screen showing some areas of the page you can add custom code to. Inside the 'Head` section, click the 'Add code' button

1. Paste the code snippet below into the first box.
2. Give your embed code a name, this can be anything you want, but I’ve used 'Payhere auto embed' in this example.
3. Click 'Apply'
4. Publish the changes to your website

Now any Payhere links that you setup using the previous guide will open embedded within your website 🎉

<script src="https://app.payhere.co/embed/embed.js"></script>
<script>
  document.addEventListener("DOMContentLoaded", function() {
    document.querySelectorAll("a").forEach(function (link) {
      const text = link.innerText.trim()
      if (link.href.startsWith("https://sandbox.payhere.co") || link.href.startsWith("https://app.payhere.co")) {
        console.log("link", link.href)
        link.addEventListener("click", function(event) {
          event.preventDefault()

          PayHere.launch({
            embedURL: link.href
          })
        })
      }
    })
  });
</script>