Jump to content

GetOrders Api Call not working for single domain


Qhiliqq
Go to solution Solved by Qhiliqq,

Recommended Posts

Hi there,

maybe it's just a bug or sth. like that.

If I use the localAPI call "GetOrders" with a order which only contains a domain, no result will be shown.
The order is present in the database.

Do you know about that?

test.php in whmcs root directory

<?php

define("WHMCS", true);

require_once __DIR__ . '/init.php';

// Test Order-ID
$orderId = 3053;

// API Call
try {
    $results = localAPI('GetOrders', [
        'id' => $orderId
    ]);

    echo "<pre>";
    print_r($results);
    echo "</pre>";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}


WHMCS: 8.13.1
PHP: 8.1.32

Edited by Qhiliqq
Link to comment
Share on other sites

Works perfectly fine for me. Same setup.

Array
(
    [result] => success
    [totalresults] => 1
    [startnumber] => 0
    [numreturned] => 1
    [orders] => Array
        (
            [order] => Array
                (
                    [0] => Array
                        (
                            [id] => 23
                            [ordernum] => 7556659495
                            [userid] => 82
                            [contactid] => 1
                            [requestor_id] => 0
                            [admin_requestor_id] => 1
                            [date] => 2023-09-23 16:11:24
                            [nameservers] => 
                            [transfersecret] => 
                            [renewals] => 
                            [promocode] => 
                            [promotype] => 
                            [promovalue] => 
                            [orderdata] => []
                            [amount] => 10.00
                            [paymentmethod] => mailin
                            [invoiceid] => 3
                            [status] => Pending
                            [ipaddress] => 
                            [fraudmodule] => 
                            [fraudoutput] => 
                            [notes] => 
                            [purchase_source] => 4
                            [has_referral_products] => 0
                            [paymentmethodname] => Mail In Payment
                            [paymentstatus] => 
                            [name] => Firstname Lastname
                            [currencyprefix] => 
                            [currencysuffix] => DKK
                            [frauddata] => 
                            [validationdata] => 
                            [renewalsByType] => Array
                                (
                                    [domains] => 
                                    [services] => 
                                    [addons] => 
                                )

                            [lineitems] => Array
                                (
                                    [lineitem] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [type] => domain
                                                    [relid] => 4
                                                    [producttype] => Domain
                                                    [product] => Register
                                                    [domain] => example.com
                                                    [billingcycle] => 1
                                                    [amount] => WHMCS\View\Formatter\Price Object
                                                        (
                                                            [price:protected] => 10
                                                            [currency:protected] => Array
                                                                (
                                                                    [id] => 1
                                                                    [code] => DKK
                                                                    [prefix] => 
                                                                    [suffix] => DKK
                                                                    [format] => 3
                                                                    [rate] => 1.00000
                                                                )

                                                            [defaultFormat:protected] => {PREFIX}{PRICE}{SUFFIX}
                                                            [defaultCurrencyDescriptor:protected] => Array
                                                                (
                                                                    [format] => 1
                                                                    [prefix] => 
                                                                    [suffix] => 
                                                                )

                                                        )

                                                    [status] => Expired
                                                    [dnsmanagement] => 0
                                                    [emailforwarding] => 0
                                                    [idprotection] => 0
                                                )

                                        )

                                )

                        )

                )

        )

)

 

Link to comment
Share on other sites

I don't get it.

I checked if a hook or sth. else cuts off the orders key, but no...
In my whole whmcs dir there is nothing with getorders, except my test.php file.

The test.php gives me:

Array
(
    [result] => success
    [totalresults] => 
    [startnumber] => 0
    [numreturned] => 
)

The weird thing is, my tblorders has the order:

stdClass Object
(
    [id] => 3053
    [ordernum] => 1406xxxxxx
    [userid] => 30
    [contactid] => 0
    [requestor_id] => 0
    [admin_requestor_id] => 2
    [date] => 2025-06-11 08:45:29
    [nameservers] => 
    [transfersecret] => 
    [renewals] => {"domains":[],"services":[],"addons":[]}
    [promocode] => 
    [promotype] => 
    [promovalue] => 
    [orderdata] => []
    [amount] => 0.00
    [paymentmethod] => mollierecurring
    [invoiceid] => 10439
    [status] => Pending
    [ipaddress] => 176.xxx.xxx.xxx
    [fraudmodule] => 
    [fraudoutput] => 
    [notes] => 
    [purchase_source] => 3
    [has_referral_products] => 0
)

 

I installed a fresh whmcs on my dev system and here it works.
So there has to be something in my current production system which changes the api output.
My whmcs installation was 2015, ten years ago and just upgraded it every time.
Maybe something old is causing this error.

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