Makedonsky Posted July 18, 2017 Share Posted July 18, 2017 Hi guys, i've spent alot of time to find how to make same or almost same button as the one we have in invoices for payment etc, but didn't find anything in WHMCS docs. What i want to achieve is to have this button on my site, which uses WHMCS for payments. I've found how to charge clients manually, through api, retrieve products, etc, but didn't find any way to get link to create this button on my site. Could you please provide a link where is manual & | example on how to do it? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 18, 2017 Share Posted July 18, 2017 normally the code for these buttons is generated by the payment gateway - usually via a form or a link. if you know the html code to use for your bitcoin button, then you could add it to the viewinvoice.tpl template close to the {$paymentbutton} code via an {if} statement... if you don't know the html code for the button, then you'll need to find out what it should be before you can add it to the template. 0 Quote Link to comment Share on other sites More sharing options...
Makedonsky Posted July 18, 2017 Author Share Posted July 18, 2017 normally the code for these buttons is generated by the payment gateway - usually via a form or a link. if you know the html code to use for your bitcoin button, then you could add it to the viewinvoice.tpl template close to the {$paymentbutton} code via an {if} statement... if you don't know the html code for the button, then you'll need to find out what it should be before you can add it to the template. Probably there's some misunderstanding. I'm perfectly satisfied with the functionality of the button i have in invoices, i don't want to change it. What i want to do is to somehow get links to payment pages(for example to paypal), which are loaded after selecting payment method and clicking "pay now" in invoices. I wan't to give those links to my customers directly on my site, without need to send them to invoice page in whmcs. So it would look like "wanna buy {{product_name}} ? click here **<a href="link/to/pay"><button>PAY NOW</button></a>** 0 Quote Link to comment Share on other sites More sharing options...
Makedonsky Posted July 18, 2017 Author Share Posted July 18, 2017 I assume this url(of paypal/bitcoin payment pages) could be obtained from API somehow, but i couldn't find it in docs. Only manual transactions and invoices. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 18, 2017 Share Posted July 18, 2017 as I said, those links are generated by the gateway... so in the case of PayPal, it's not a URL link, but an html form with a *lot* of hidden fields... now you could regenerate the form outside of the invoices page manually, but all of the hidden fields would need to be present - and generating their content values will need some additional coding - possibly even hooks to pull the info from the db... depending on where you want to do this. also, from your above example, it looks like you're bypassing WHMCS and just taking payment direct from paypal (or elsewhere)... so no order, no invoice ??? I suppose you could use a paypal.me link, but I doubt you could link it to a specific WHMCS purchase or invoice. if I understand what you want to do, there's no quick way to do it - you'd need to code each gateway individually and take into account the security implications when doing so. 0 Quote Link to comment Share on other sites More sharing options...
Makedonsky Posted July 18, 2017 Author Share Posted July 18, 2017 as I said, those links are generated by the gateway... so in the case of PayPal, it's not a URL link, but an html form with a *lot* of hidden fields... now you could regenerate the form outside of the invoices page manually, but all of the hidden fields would need to be present - and generating their content values will need some additional coding - possibly even hooks to pull the info from the db... depending on where you want to do this. also, from your above example, it looks like you're bypassing WHMCS and just taking payment direct from paypal (or elsewhere)... so no order, no invoice ??? I suppose you could use a paypal.me link, but I doubt you could link it to a specific WHMCS purchase or invoice. if I understand what you want to do, there's no quick way to do it - you'd need to code each gateway individually and take into account the security implications when doing so. I wan't to preserve WHMCS functionality - orders, transactions, tracking, logging, etc. I just don't want to force clients to walk one more step(e.g. sending them to invoice page) each time they'll buy something in my system, but i didn't implement custom billing, just pulling everything to and from WHMCS API atm, so implementing integration with each payment system manually would be hassle. Just to be sure we understood each other well, i want to perform these steps: 1) I create order using WHMCS API with some products for some user(user interacts directly with my site) 2) I create invoie with that order using WHMCS API. 3) I get invoice info from WHMCS API, like price/number etc. 4) I get links to pay this invoice from WHMCS API(links to paypal page you get redirected to when you click "pay now" or page with bitcoin QR-code that gets rendered on invoice page) - this is the problem place. 5) Display them to client in form of my own "pay with paypal, pay with bitcoin" buttons. 6) Finish order by adding invoice payment from transaction that created after client finished his actions on 3rd party page. Could that be done with WHMCS, or there are only 2 options: 1) I send user to invoice page where he pays. 2) I re-invent the wheel and make all the integrations manually, without WHMCS? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 19, 2017 Share Posted July 19, 2017 with regards to 4, I believe the PP button code is hard-coded by WHMCS - so they aren't using an API or function to generate the PayPal code for example... though I daresay you could write one.... it should just be a case of either reverse-engineering from the PayPal button output on the invoice page to find the variables required, or by reading the PayPal API... and then doing similar steps for other gateway options. I think your 1-6 steps could be done... whether it's worth the effort is not for me to say. 0 Quote Link to comment Share on other sites More sharing options...
Makedonsky Posted July 20, 2017 Author Share Posted July 20, 2017 with regards to 4, I believe the PP button code is hard-coded by WHMCS - so they aren't using an API or function to generate the PayPal code for example... though I daresay you could write one.... it should just be a case of either reverse-engineering from the PayPal button output on the invoice page to find the variables required, or by reading the PayPal API... and then doing similar steps for other gateway options. I think your 1-6 steps could be done... whether it's worth the effort is not for me to say. Thanks for responses, brian. Looks like i'll be doing exactly that. Sorrow story that WHMCS doesn't provide such APIs. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.