Iframe client portal together with "Buy now" button does not work with "Payment"

When using the iframe client portal solution on my own website, there is a problem when you use the buy now button.

The option “Landing Page” under “Buy Now Buttons” has two options:

  • Invoice
  • Payment

The payment option does not work, it will always show the invoice page first.

I can see the iframe code is not setup to show this properly:

<center>
<iframe id="invoiceIFrame" width="100%" height="1200" style="max-width:1000px"></iframe>
<center>
<script language="javascript">
var iframe = document.getElementById('invoiceIFrame');
iframe.src = 'https://app.invoiceninja.com/view/'
             + window.location.search.substring(1, 33);
</script>

It should be something like this:

<center>
<iframe id="invoiceIFrame" width="100%" height="1200" style="max-width:1000px"></iframe>
<center>
<script language="javascript">
var iframe = document.getElementById('invoiceIFrame');
var ninja_hash = window.location.search.substring(1, 33);
iframe.src = (window.location.search.substring(1).search('credit_card') != -1 ? 'https://app.invoiceninja.com/payment/' + ninja_hash + '/credit_card' : 'https://app.invoiceninja.com/view/' + ninja_hash);
</script>

Now the invoice options works, you are redirected to that page, but there is a small problem. For some reason the white button that takes you back to the invoice page from the payment page has the wrong URL, it has the same URL as the current page (the payment page).

Is there something I can do to make this work?

Thanks.

It sounds like a bug, we’ll look into fixing it in our next release.

Thanks :slight_smile:

This is the fastest support in the world.

How do I know when this bug has been fixed, can I follow the bug and be notified?

Here’s the fix if you want to apply the patch to your code.

https://github.com/invoiceninja/invoiceninja/commit/3e609179993bcb4d0b6f9094d19dd04409e5c8b6

In the future if you create an issue on GitHub you’re able to follow it.

https://github.com/invoiceninja/invoiceninja/issues

Wow, that was fast :slight_smile: thanks.

I have created the bug, just for the fun of it.