Jump to content

Is order ID always equal to Invoice ID


dotbloup

Recommended Posts

If I understand it well, in WHMCS, the order ID is always equal to invoice ID? In WHMCS, when an order is created, an invoice is also simulteneously created.

I wonder if I can use an Invoice ID to find an order ID when i call it from an internal API function.

. Are there situations where the Order ID isn't equal anymore to the Invoice ID? 

Link to comment
Share on other sites

orderID and invoiceID are two separate things and are not "in sync", but they are "connected" in WHMCS DB tables

They may be the same in the beggining (for the first few orders) as each order creates a new invoice. As soon as you create an invoice on itself, IDs will not be the same.

I don't think any API function gets you the orderID from an invoiceID but you can get it yourself.
If you need to get the orderID from the original invoiceID generated by that order, try something like this:

use Illuminate\Database\Capsule\Manager as DB;
$orderID = DB::table('tblorders')->where('invoiceid', '1')->value('id');

 

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