Jump to content

Order Shows Pending But Payment is Done , Complete Solution (Solution)


Recommended Posts

So Hello Guys if you are facing this issue that your payment is done on your whmcs but still it shows order is pending , I have and complete and permanently solution , I give you a auto accept order hook ... So let's start it....

1. Step One :

Go to your whmcs directory in your cpanel where your whmcs is installed on , now go to includes/hooks , or public_html/includes/hooks

2. Step two :

create a file in your includes/hooks/ folder create a file names ' jetserver_AutoAcceptOrders.php '

3. Step three :

Edit the file you created and paste this below code on jetserver_AutoAcceptOrders.php file :

<?php
/*
*
* Auto Accept Orders
* Created By Idan Ben-Ezra
*
* Copyrights @ Jetserver Web Hosting
* www.jetserver.net
*
* Hook version 1.0.1
*
**/
if (!defined("WHMCS"))
    die("This file cannot be accessed directly");

/*********************
 Auto Accept Orders Settings
*********************/
function jetserverAutoAcceptOrders_settings()
{
    return array(
        'apiuser'        => 'whmcsadminusername', // one of the admins username
        'autosetup'         => true, // determines whether product provisioning is performed
        'sendregistrar'     => true, // determines whether domain automation is performed
        'sendemail'         => true, // sets if welcome emails for products and registration confirmation emails for domains should be sent 
        'ispaid'        => true, // set to true if you want to accept only paid orders
        'paymentmethod'        => array(), // set the payment method you want to accept automaticly (leave empty to use all payment methods) * example array('paytm','Paytm')
    );
}
/********************/

function jetserverAutoAcceptOrders_accept($vars) 
{
    $settings = jetserverAutoAcceptOrders_settings();

    $ispaid = true;

    if($vars['InvoiceID'])
    {
        $result = localAPI('getinvoice', array(
            'invoiceid'         => $vars['InvoiceID'],
        ), $settings['apiuser']);

        $ispaid = ($result['result'] == 'success' && $result['balance'] <= 0) ? true : false;
    }

    if((!sizeof($settings['paymentmethod']) || sizeof($settings['paymentmethod']) && in_array($vars['PaymentMethod'], $settings['paymentmethod'])) && (!$settings['ispaid'] || $settings['ispaid'] && $ispaid))
    {
        $result = localAPI('acceptorder', array(
            'orderid'         => $vars['OrderID'],
            'autosetup'         => $settings['autosetup'],
            'sendregistrar'     => $settings['sendregistrar'],
            'sendemail'         => $settings['sendemail'],
        ), $settings['apiuser']);
    }
}

add_hook('AfterShoppingCartCheckout', 0, 'jetserverAutoAcceptOrders_accept');

?>

 

Step 4

   'apiuser'        => 'whmcsadminusername', // one of the admins username

Replace whmcsadminusername to your admin username of your whmcs...

 

If any issue then comment please

Edited by WHMCS ChrisD
Added code into codebox
Link to comment
Share on other sites

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.

  • 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