The Official .NET Recurly API client library.
Compatible with .NET >=3.5 and Recurly API v2.
If you use NuGet, simply run the following:
PM> Install-Package recurly-api-client
You may also visit our Releases page to download the latest version. Then add the Recurly.dll
as a reference to your solution.
Alternatively, you can use use git to work with the latest changes in development.
git clone git://github.com/recurly/recurly-client-net.git C:\path\to\recurly
For more information about getting started with git, please check out the Github Guide for Windows.
Specify your API Key, site subdomain, private key, and (optionally) page size setting in your app.config
or web.config
file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="recurly" type="Recurly.Configuration.Section,Recurly"/>
</configSections>
<recurly
apiKey="123456789012345678901234567890ab"
privateKey="123456789012345678901234567890cd"
subdomain="company"
pageSize="50" /> <!-- optional. 50 is the default -->
</configuration>
Full C# API documentation available here.
To create an account with account code
and name
:
var account = new Account("123")
{
FirstName = "John",
LastName = "Smith"
}
account.Create();
Get the account with account code
123:
var account = Accounts.Get("123");
List all available Accounts
and print their account codes
:
var accounts = Accounts.List();
foreach (var account in accounts)
Console.WriteLine(account.AccountCode);
Get an account's billing information:
var account = Accounts.Get("123");
var info = account.BillingInfo;
Create a coupon with code WINTER, name, and with a 10% discount:
var coupon = new Coupon("WINTER", "Winter discount", 10);
coupon.Create();
Redeem that coupon on an account that uses US dollars, getting a CouponRedemption
object:
var redemption = account.RedeemCoupon("WINTER", "USD");
Each section of the API (Accounts, Invoices, Transactions, etc.) has static references for getting or listing their types and concrete implementations for manipulating concrete objects.
Please see the Recurly API for more information.
Looking for help? Please contact [email protected] or visit support.recurly.com.
Stackoverflow is also a great place to talk to the community and find answers to common questions.
For the latest API and client library announcements follow Recurly on Twitter and join our Google Group: