Jump to content

Help with WHMCS order configuration


Recommended Posts

Hi,
I'm an italian web developer and I'm working with a fresh WHMCS 7.0 installation and it's configuration. (Plus license version)
I'm new with this platform and I'm searching a solution to auto confirm status order after the invoices pass to paid status.

For example, a client place a new order with paypal and the new placed order cause it's payed with paypal, has the invoice in paid status.
When the status become paid the order status automatically become in complete status with the domain registration with namecheap.

I've already set namecheap for domain registration but I can't find in the configurations a way to auto confirm the order status when the invoice is paid.
There is a setting in setup voices? Or I need to install an addon to do this?

 

Link to comment
Share on other sites

  • WHMCS Technical Analyst II

Hello,

Thank you for your post!

You can use a hook to achieve this, for the example the 'AfterShoppingCartCheckout' hook point.

Please see: https://developers.whmcs.com/hooks/

This has been discussed in another thread on our community by other members which I would advise viewing as it contains some very useful information:

 

Link to comment
Share on other sites

Gotta love redirects that don't answer the question, but send you down a rabbit hole of redirects. That's top class support there, WHMCS!!! How about taking a few minutes and answering the questions properly, and give them an example of how to do it instead of "look here" or "search the forums". Insulting to say the least.

@m.azzalin.doc , the answer posted was correct, you'll need to use a hook, and API to do this. Something like this should do the trick. If you run into problems, let me know . Place the following code in a php file (call it whatever you want just as long as it's a .php file) in whmcs/includes/hooks.

 

<?php
//simple hook and API call to process orders once payment is made immediately
//provided courtesy of https://www.whmcs.guru
use Illuminate\Database\Capsule\Manager as Capsule;

function custom_activateorder($vars)
{
	$adminuser = "CHANGEME";
	$command = 'AcceptOrder';
	$registrar = 'registrar';
	$invoiceid = $vars['invoiceid'];
	$invoiceorders = Capsule::table('tblorders')->where('invoiceid', '=',  $invoiceid)->pluck('id');
	if (is_array($invoiceorders))
	{
		$invoiceorders = $invoiceorders['0'];
	}

	$postData = array(
	'orderid' => $invoiceorders,
	'registrar' => $registrar,
	'autosetup' => '1',
	'sendemail' => '1',


	);


$results = localAPI($command, $postData, $adminuser);

}
add_hook("InvoicePaid",1,"custom_activateorder");

The only thing you need to change is the admin user, and registrar. 

Take a look at the AcceptOrder API (assuming they don't change the link again) for other options you can add at the end of that

Link to comment
Share on other sites

6 hours ago, twhiting9275 said:

Gotta love redirects that don't answer the question, but send you down a rabbit hole of redirects. That's top class support there, WHMCS!!! How about taking a few minutes and answering the questions properly, and give them an example of how to do it instead of "look here" or "search the forums". Insulting to say the least.

or adding a link to your own site in the sample code... some may interpret that as self-promotion on your part.... I couldn't possibly comment. 9_9

Link to comment
Share on other sites

That's pretty common stuff. At least I helped the user instead of sending them down a rabbit hole and doing nothing to actually help them.

It took (maybe) 10 minutes to put that together, tops. There's no reason to send people on a wild goose chase, or tell them "search for the answer yourself" here. That's not helpful at all.

Link to comment
Share on other sites

13 hours ago, twhiting9275 said:

or tell them "search for the answer yourself" here. That's not helpful at all.

so you'd want this place filled with different users repeatedly asking the same questions on a regular basis... even if you haven't, i've got better things to do than copy&paste old answers ad infinitum.

of course, if it helps get your post count up and allows you to mention your website, then I can see why you might take a different view. 49oa9Ad.gif

if you can give a helpful reply without linking to your website, why include it.. and if you don't want to post code without adding the link, then you'd be admitting you do it purely for self promotion.

Link to comment
Share on other sites

Very thanks @twhiting9275, the hook it's working and the problem is solved.

I like your way of thinking about help on the forums.
I used the search button before to write my question, but I'm inexpert in WHMCS world and I haven't understand all the response in the finded questions.

When I realized the hook process, I read the developer documentation to understand events and internal api.
With your example I resolved my question in 10 minutes, in a context where I'm setting WHMCS for a simple company request, when our business is different and also my skills. 

Thanks a lot!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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