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)
https://developers.whmcs.com/api-reference/gettransactions/
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);
}
}
}
}