Jump to content

View invoice to specific payment gateway


DJPRMF

Recommended Posts

Hello,

Quick question: there is any way of redirect the users to a specific payment gateway in a direct link to the "view invoice" page? This despite the "default payment" method selected by the user.

For instance: https://whmcs.domain/viewinvoice.php?id=1234&gateway=SOMETHING

Thank you

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 17/04/2020 at 14:12, DJPRMF said:

Quick question: there is any way of redirect the users to a specific payment gateway in a direct link to the "view invoice" page? This despite the "default payment" method selected by the user.

you'd have to use a hook to modify the gateway dropdown and payment method details... and I don't know whether it would still work if the user wasn't logged in and so needed to login first...

in any event, the user could change the gateway to their default method if they choose to (assuming they have the choice).

Link to comment
Share on other sites

  • 3 weeks later...
4 hours ago, DJPRMF said:

But what i am looking is direct them to a specific payment depending on the link access.

a link from where - the client area when they're already logged in or in an email ?

4 hours ago, DJPRMF said:

https://whmcs.domain/viewinvoice.php?id=1234&gateway=paypal

The tag "gateway" (or something else, doesn't matter) redirect to the gateway "PayPal".

what does the link do - just take them to the viewinvoice page and preselect a specific gateway - or do you actually want to forward them to PayPal from that link ??

also, do you have Clients Choose Gateway enabled ?

Link to comment
Share on other sites

6 hours ago, DJPRMF said:

But what i am looking is direct them to a specific payment depending on the link access.

a link from where - the client area when they're already logged in or in an email ?

6 hours ago, DJPRMF said:

https://whmcs.domain/viewinvoice.php?id=1234&gateway=paypal

The tag "gateway" (or something else, doesn't matter) redirect to the gateway "PayPal".

what does the link do - just take them to the viewinvoice page and preselect a specific gateway - or do you actually want to forward them to PayPal from that link ??

also, do you have Clients Choose Gateway enabled ?

Link to comment
Share on other sites

12 hours ago, DJPRMF said:

Basically, is a link that i can provide to the client and will preselect a specific gateway. 

I get that - but you still haven't said whether CCG is enabled... e.g is there a dropdown on the viewinvoice page or do the invoices only have one option - because the answer to that will decide how to do this.

Link to comment
Share on other sites

15 hours ago, DJPRMF said:

There is a dropdown with multiple gateways. I think that is the default way of the page "viewinvoice" in the WHMCS. 🙂 

it's an option you can enable/disable in the settings - and I can't remember if its on by default.

let me have a ponder on this, because I think the simpler solution would be to use jQuery to change the dropdown and then that should change the payment method details too (which in the case of PayPal includes a form generated by WHMCS internally)... but the invoice page doesn't have a header or footer, so injecting code via a hook is a little more involved... and I don't particularly just want to do it in the template if that can be avoided.

Link to comment
Share on other sites

well I quickly wrote a hook for this (no jQuery involved) and it works perfectly... except for some reason, you couldn't use gateway in the URL as you wanted to. 😕

that intrigued me as to why not and I then found that under certain circumstances, you can already do what you want by default with WHMCS - but you would have to pass the token value in the link.... which if the client is already logged in, you should have access to...

i've never seen any documentation on this hidden feature or that it was even possible.

<a href="viewinvoice.php?id={$invoiceid}&gateway=banktransfer&token={$token}">bank transfer</a><br />
<a href="viewinvoice.php?id={$invoiceid}&gateway=mailin&token={$token}">cheque</a>

now depending on where you're linking from, $invoiceid might not exist as a variable - but you surely will know which invoice you're wanting to link to, and therefore that value (hardcoded or other existing variable) can be used in your link(s).

if using a token is not practical in your circumstances, then I can let you have the hook I wrote - links work as per above except you don't need to pass the token - I just wish that i'd found that out about the feature before writing the damn hook! 😠

Link to comment
Share on other sites

WoW, this is awesome. I also didn't know that.

I have tried the "gateway" variable in the link, but it didn't work. Adding the token work just fine.

Thank you so much! 😄

If you have the hook to share, i appreciate that also 😄 

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated