{"_id":"558206128625220d00429f31","initVersion":{"_id":"555fbba928249c1900618a85","version":"1.0"},"project":"555fbba928249c1900618a82","user":{"_id":"55648cf93b87582b003ab8b1","username":"","name":"Chris Bunting"},"__v":0,"hidden":false,"createdAt":"2015-06-17T23:43:14.495Z","fullscreen":false,"htmlmode":false,"html":"","body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"Please [click here](https://dev.recurly.com/v2.8/page/net-updates) for details on which versions are affected and how to upgrade your version with the patch.\",\n  \"title\": \"IMPORTANT UPDATE FOR RECURLY CLIENT LIBRARIES RELEASED PRIOR TO May 9th, 2018\"\n}\n[/block]\nThe [Recurly .NET Client library](https://github.com/recurly/recurly-client-net) is an open source library to interact with Recurly’s subscription management from your .NET application. The library interacts with Recurly’s v2 API.\n\nView the [GitHub project site](https://github.com/recurly/recurly-client-net) for a list of requirements and download/install instructions.\n\n* [Configuration](#configuration)\n* [Using the API](#using-the-api)\n* [Handling Errors](#handling-errors)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configuration\"\n}\n[/block]\nTo configure the library, you will need your API Key and site subdomain. The recommended way to configure the library is to statically initialize it:\n\n```\n// pageSize is optional and defaults to 200\nRecurly.Configuration.SettingsManager.Initialize(apiKey, subdomain, pageSize);\n```\n\nWe recommend doing this for compatibility with newer .NET frameworks as well as security. We also recommend you encrypt your api key at rest or use a secrets service. *You should not store your api key in plain text on your system.*\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Configuration Security\",\n  \"body\": \"If you are using the legacy method of configuring with app.config or web.config, we strongly recommend updating your updating your application to use the above method\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Using the API\"\n}\n[/block]\nEach endpoint is documented with examples [here](https://dev.recurly.com/docs/getting-started). Feel free to explore them for more information related to specific endpoints.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Handling Errors\"\n}\n[/block]\nAny request which results in an HTTP 404 returned from the API will throw a `Recurly.NotFoundException`. For example:\n\n```\ntry\n{\n    var account = Accounts.Get(\"1\");\n    Console.WriteLine(\"Account \" + account);\n}\ncatch (NotFoundException e)\n{\n    Console.WriteLine(\"Account not found.\");\n}\n```\n\nAdditional errors can be found [here](https://github.com/recurly/recurly-client-net/blob/master/Library/Errors.cs)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Support\"\n}\n[/block]\nLooking for help? Please contact <support@recurly.com> or visit [support.recurly.com](https://support.recurly.com/).\n[Stackoverflow](http://stackoverflow.com/questions/tagged/recurly) is also a great place to talk to the community and find answers to common questions.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Announcements\"\n}\n[/block]\nFor the latest API and client library announcements follow Recurly on Twitter and join our Google Group:\n\n- [@recurly](https://twitter.com/recurly)\n- [Recurly Google Group](http://groups.google.com/group/recurly-api)","slug":"net","title":".NET"}

.NET


[block:callout] { "type": "danger", "body": "Please [click here](https://dev.recurly.com/v2.8/page/net-updates) for details on which versions are affected and how to upgrade your version with the patch.", "title": "IMPORTANT UPDATE FOR RECURLY CLIENT LIBRARIES RELEASED PRIOR TO May 9th, 2018" } [/block] The [Recurly .NET Client library](https://github.com/recurly/recurly-client-net) is an open source library to interact with Recurly’s subscription management from your .NET application. The library interacts with Recurly’s v2 API. View the [GitHub project site](https://github.com/recurly/recurly-client-net) for a list of requirements and download/install instructions. * [Configuration](#configuration) * [Using the API](#using-the-api) * [Handling Errors](#handling-errors) [block:api-header] { "type": "basic", "title": "Configuration" } [/block] To configure the library, you will need your API Key and site subdomain. The recommended way to configure the library is to statically initialize it: ``` // pageSize is optional and defaults to 200 Recurly.Configuration.SettingsManager.Initialize(apiKey, subdomain, pageSize); ``` We recommend doing this for compatibility with newer .NET frameworks as well as security. We also recommend you encrypt your api key at rest or use a secrets service. *You should not store your api key in plain text on your system.* [block:callout] { "type": "warning", "title": "Configuration Security", "body": "If you are using the legacy method of configuring with app.config or web.config, we strongly recommend updating your updating your application to use the above method" } [/block] [block:api-header] { "type": "basic", "title": "Using the API" } [/block] Each endpoint is documented with examples [here](https://dev.recurly.com/docs/getting-started). Feel free to explore them for more information related to specific endpoints. [block:api-header] { "type": "basic", "title": "Handling Errors" } [/block] Any request which results in an HTTP 404 returned from the API will throw a `Recurly.NotFoundException`. For example: ``` try { var account = Accounts.Get("1"); Console.WriteLine("Account " + account); } catch (NotFoundException e) { Console.WriteLine("Account not found."); } ``` Additional errors can be found [here](https://github.com/recurly/recurly-client-net/blob/master/Library/Errors.cs) [block:api-header] { "type": "basic", "title": "Support" } [/block] Looking for help? Please contact <support@recurly.com> or visit [support.recurly.com](https://support.recurly.com/). [Stackoverflow](http://stackoverflow.com/questions/tagged/recurly) is also a great place to talk to the community and find answers to common questions. [block:api-header] { "type": "basic", "title": "Announcements" } [/block] For the latest API and client library announcements follow Recurly on Twitter and join our Google Group: - [@recurly](https://twitter.com/recurly) - [Recurly Google Group](http://groups.google.com/group/recurly-api)