Skip to content is a sync/async .NET 4.5+ client, and a portable class library for
Branch: master
Clone or download
Latest commit ef58d58 Mar 25, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Bump version to 25.2.0 Mar 25, 2019
.gitattributes normalize line endings Jan 31, 2015
LICENSE Revert "Fix license packaging" Jan 20, 2019
global.json Remove +x flag from source files Oct 22, 2018

Build status NuGet Coverage Status

The official Stripe library, supporting .NET Standard 1.2+, .NET Core 1.0+, and .NET Framework 4.5+


See the .NET API docs.


Install via NuGet

From the command line:

nuget install

From Package Manager:

PM> Install-Package

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "".
  5. Click on the package, select the appropriate version in the right-tab and click Install.

Set the API Key for your project

You can configure the package to use your secret API key in one of two ways:

a) In your application initialization, set your API key (only once once during startup):

StripeConfiguration.SetApiKey("[your api key here]");

b) Pass the API key to RequestOptions:

var planService = new PlanService();
planService.Get(*planId*, new RequestOptions { ApiKey = "[your api key here]" });

You can obtain your secret API key from the API Settings in the Dashboard.

Xamarin/Mono Developers (Optional)

If you are using Xamarin/Mono, you may want to provide your own HttpMessageHandler. You can do so by passing an instance to StripeConfiguration.HttpMessageHandler on your application's startup. See this thread for details.

Additional Resources


Helpful Library Information

Request Options

All of the service methods accept an optional RequestOptions object. This is used if you need an Idempotency Key, if you are using Stripe Connect, or if you want to pass the secret API key on each method.

var requestOptions = new RequestOptions();
requestOptions.ApiKey = "SECRET API KEY";                        // (optional) set the api key on a per-request basis
requestOptions.IdempotencyKey = "SOME STRING";                   // (optional) create an idempotent request
requestOptions.StripeConnectAccountId = "CONNECTED ACCOUNT ID";  // (optional) authenticate as a connected account


The StripeResponse object is an attribute (with the same name) attached to all entities in when they are returned from a service call.

Example: Access the StripeResponse

var chargeService = new ChargeService();
StripeCharge charge = chargeService.Create(...);
StripeResponse response = charge.StripeResponse;

The information that can be derived from the StripeResponse is available from the StripeResponse Class.

public class StripeResponse
	// ResponseJson will always tell you the complete json Stripe returned to
	// this will be the same as the ObjectJson when you execute a create/get/delete call.
	// however, if you execute a List() method, the ResponseJson will have the full api result
	// from Stripe (a charge list with 10 charges, for example).
	public string ResponseJson { get; set; }

	// when you call a List() method, the object json is the object in the response array that represents
	// the entity. The ResponseJson will be the full array returned from Stripe on every entity, however,
	// since that was the full response from Stripe. ObjectJson is always the same as ResponseJson when
	// you are doing a regular create/get/delete, because you are dealing with a single object.
	public string ObjectJson { get; set; }

	// this is the request id of the call, as seen in the Stripe dashboard. I would recommend logging
	// this and/or saving it to your database. this is very useful to help you find your request
	// in the dashboard, or ask Stripe a question about your api call
	public string RequestId { get; set; }

	// this is the request date and time of the call. I would also recommend logging this and/or
	// saving it to your database, as it tells you when Stripe processed the request.
	public DateTime RequestDate { get; set; }

Date Filtering

Many of the List()-methods support parameters to filter by date. You can use the DateFilter class to combine the filters to make more interesting and complex queries.

Example: Interesting Queries with DateFilter

var chargeService = new ChargeService();

var chargesToday = chargeService.List(new ChargeListOptions {
	Created = new DateFilter { GreaterThanOrEqual = DateTime.UtcNow.Date }

var chargesYesterday = chargeService.List(new ChargeListOptions {
	Created = new DateFilter {
		GreaterThanOrEqual = DateTime.Now.AddDays(-1).Date,
		LessThan = DateTime.Now.Date

Contribution Guidelines

We welcome contributions from anyone interested in Stripe or development. If you'd like to submit a pull request, it's best to start with an issue to describe what you'd like to build.

Once you've written your pull request, please make sure you test your changes.

You can’t perform that action at this time.