Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

GetTransactions()

hitmanpt edited this page Feb 9, 2017 · 1 revision

Through this explanation we assume that you have using WHMCS_API; on the begining of the file
And the API() class initialized as _api
If needed check the Getting Started page

Contents


Function Overview

Prototype: public GetTransactions.GetTransactions GetTransactions(int InvoiceID = -1, int ClientID = -1, string TransactionID = "")

Input:

  • InvoiceID: Obtain transactions for a specific invoice id (optional)
  • ClientID: Find transactions for a specific client id (optional)
  • TransactionID: Find transactions for a specific transaction id (optional)

Output: GetTransactions Model


Function Details

To call it just use GetTransactions.GetTransactions tr = _api.GetTransactions(ClientID: 1);

This call to the function will ignore all arguments except ClientID

The GetTransactions model is inside it's own namespace (more info)

View all details about GetTransactions Model

https://developers.whmcs.com/api-reference/gettransactions/

Donate


Full example

using WHMCS_API;

namespace YourApp
{
  class YourClass
  {
    public void YourFunction()
    {
       API _api = new API("username", "password", "accesskey", "url");
       GetTransactions.GetTransactions tr = _api.GetTransactions(ClientID: 1);      
       Console.WriteLine("This client has {0} products", cp.NumberReturned);
       foreach(GetTransactions.Transaction t in tr.Transactions.Transaction)
       {
         Console.WriteLine("This transaction matches the invoice: {0}", t.InvoiceID);
       }
    }
  }
}