ZuoraSDK 0.0.1-alpha.4
dotnet add package ZuoraSDK --version 0.0.1-alpha.4
NuGet\Install-Package ZuoraSDK -Version 0.0.1-alpha.4
<PackageReference Include="ZuoraSDK" Version="0.0.1-alpha.4" />
paket add ZuoraSDK --version 0.0.1-alpha.4
#r "nuget: ZuoraSDK, 0.0.1-alpha.4"
// Install ZuoraSDK as a Cake Addin #addin nuget:?package=ZuoraSDK&version=0.0.1-alpha.4&prerelease // Install ZuoraSDK as a Cake Tool #tool nuget:?package=ZuoraSDK&version=0.0.1-alpha.4&prerelease
ZuoraSDK
The official Zuora .NET SDK, supporting .NET 8.0 and higher.
<a id="installation"></a>
Installation
Using the [.NET Core command-line interface (CLI) tools][dotnet-core-cli-tools]:
dotnet add package ZuoraSDK
Using the [NuGet Command Line Interface (CLI)][nuget-cli]:
nuget install ZuoraSDK
Using the [Package Manager Console][package-manager-console]:
Install-Package ZuoraSDK
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "ZuoraSDK".
- Click on the ZuoraSDK package, select the appropriate version in the right-tab and click Install.
Documentation
For a comprehensive list of examples, check out the API documentation.
<a id="Usage"></a>
Usage
Client Initialization
Initialize the client with your client id and client secret:
ZuoraClient zuoraClient = new ZuoraClient("client-id", "client-Secret", ZuoraEnv.PROD);
zuoraClient.Initialize();
Create a resource
The CreateAccount
method of the AccountsApi
Api class can be used to create a new Account
resource:
CreateAccountContact contact = new CreateAccountContact(
firstName: "firstName",
lastName: "lastName",
country: "United States",
state: "CA"
);
CreateAccountPaymentMethod paymentMethod = new CreateAccountPaymentMethod(
type: "CreditCard",
cardType: "Visa",
cardNumber: "4111111111111111",
expirationMonth: 10,
expirationYear: 2025,
securityCode: "123",
cardHolderInfo: new CreatePaymentMethodCardholderInfo(cardHolderName: "test")
);
CreateAccountRequest createAccountRequest = new CreateAccountRequest(
name: "test",
paymentMethod: paymentMethod,
billToContact: contact,
billCycleDay: 1,
soldToSameAsBillTo: true,
autoPay: false,
currency: "USD"
);
// create
createAccountRequest.AdditionalProperties.Add("reqtext5__c", "c#");
CreateAccountResponse response = zuoraClient.AccountsApi.CreateAccount(createAccountRequest);
Console.WriteLine(response);
Retrieve a resource
The CreateAccount
method of the AccountsApi
Api class can be used to create a new Account
resource:
The GetAccount
method of the AccountsApi
Api class can be used to retrieve a Account
resource:
AccountDetailResponse accountDetailResponse = zuoraClient.AccountsApi.GetAccount(response.AccountId);
Console.WriteLine(accountDetailResponse);
Updating a resource
The UpdateAccount
method of the AccountsApi
Api class can be used to update a Account
resource:
UpdateAccountRequest updateAccountRequest = new UpdateAccountRequest(name: "jianfeng", billCycleDay: 1);
CommonResponse commonResponse = zuoraClient.AccountsApi.UpdateAccount(response.AccountId, updateAccountRequest);
Console.WriteLine(commonResponse);
Deleting a resource
The DeleteAccount
method of the AccountsApi
Api class can be used to delete a Account
resource:
DeleteAccountResponse deleteAccountResponse = zuoraClient.AccountsApi.DeleteAccount(response.AccountId);
Console.WriteLine(deleteAccountResponse);
Full Example
using System.Collections.Generic;
using System.Diagnostics;
using ZuoraSDK.Client;
using ZuoraSDK.Model;
using ZuoraSDK.Api;
namespace Example
{
public class Example
{
public static void Main()
{
ZuoraClient zuoraClient = new ZuoraClient("client-id", "client-Secret", ZuoraEnv.PROD);
try
{
zuoraClient.Initialize();
CreateAccountContact contact = new CreateAccountContact(
firstName: "firstName",
lastName: "lastName",
country: "United States",
state: "CA"
);
CreateAccountPaymentMethod paymentMethod = new CreateAccountPaymentMethod(
type: "CreditCard",
cardType: "Visa",
cardNumber: "4111111111111111",
expirationMonth: 10,
expirationYear: 2025,
securityCode: "123",
cardHolderInfo: new CreatePaymentMethodCardholderInfo(cardHolderName: "test")
);
CreateAccountRequest createAccountRequest = new CreateAccountRequest(
name: "test",
paymentMethod: paymentMethod,
billToContact: contact,
billCycleDay: 1,
soldToSameAsBillTo: true,
autoPay: false,
currency: "USD"
);
// create
createAccountRequest.AdditionalProperties.Add("reqtext5__c", "c#");
CreateAccountResponse response = zuoraClient.AccountsApi.CreateAccount(createAccountRequest);
Console.WriteLine(response);
// update
UpdateAccountRequest updateAccountRequest = new UpdateAccountRequest(name: "jianfeng", billCycleDay: 1);
CommonResponse commonResponse = zuoraClient.AccountsApi.UpdateAccount(response.AccountId, updateAccountRequest);
Console.WriteLine(commonResponse);
// get
AccountDetailResponse accountDetailResponse = zuoraClient.AccountsApi.GetAccount(response.AccountId);
Console.WriteLine(accountDetailResponse);
// delete
DeleteAccountResponse deleteAccountResponse = zuoraClient.AccountsApi.DeleteAccount(response.AccountId);
Console.WriteLine(deleteAccountResponse);
}
catch (ApiException e)
{
Debug.Print("Exception when calling api: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Beta SDKs
ZuoraSDK has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
To install a beta version of ZuoraSDK use the version parameter with dotnet add package
command:
dotnet add package ZuoraSDK --version <beta version>
Beta versions are appended with -beta.X
such as 3.2.1-beta.1
. Make sure to choose the version that includes support for the beta you are interested in!
Support
New features and bug fixes are released on the latest major version of the ZuoraSDK client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- JsonSubTypes (>= 2.0.1)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 8.1.0)
- RestSharp (>= 110.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.1-alpha.4 | 41 | 11/21/2024 |
0.0.1-alpha.3 | 39 | 11/20/2024 |
0.0.1-alpha.2 | 41 | 11/18/2024 |
0.0.1-alpha.1 | 27 | 11/15/2024 |
Minor update