Stripe.Net alternatives and similar packages
Based on the "E-Commerce and Payments" category.
Alternatively, view Stripe.Net alternatives based on common mentions on social networks and blogs.
-
nopCommerce
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart. -
SimplCommerce
A simple, cross platform, modularized ecommerce system built on .NET Core -
SmartStoreNET
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution -
GrandNode
Open source, headless, multi-tenant eCommerce platform built with .NET Core, MongoDB, AWS DocumentDB, Azure CosmosDB, Vue.js. -
Paypal Merchant SDK
Official Paypal Merchant SDK for .NET -
ServiceStack.Stripe
Typed .NET clients for stripe.com REST APIs
Developer Ecosystem Survey 2022
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Stripe.Net or a related project?
README
Stripe.net
The official Stripe .NET library, supporting .NET Standard 2.0+, .NET Core 2.0+, and .NET Framework 4.6.1+.
Installation
Using the .NET Core command-line interface (CLI) tools:
dotnet add package Stripe.net
Using the NuGet Command Line Interface (CLI):
nuget install Stripe.net
Using the Package Manager Console:
Install-Package Stripe.net
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 "Stripe.net".
- Click on the Stripe.net package, select the appropriate version in the right-tab and click Install.
Documentation
For a comprehensive list of examples, check out the API documentation. See video demonstrations covering how to use the library.
Usage
Per-request configuration
All of the service methods accept an optional RequestOptions
object. This is
used if you want to set 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";
requestOptions.IdempotencyKey = "SOME STRING";
requestOptions.StripeAccount = "CONNECTED ACCOUNT ID";
Using a custom HttpClient
You can configure the library with your own custom HttpClient
:
StripeConfiguration.StripeClient = new StripeClient(
apiKey,
httpClient: new SystemNetHttpClient(httpClient));
Please refer to the Advanced client usage wiki page to see more examples of using custom clients, e.g. for using a proxy server, a custom message handler, etc.
Automatic retries
The library automatically retries requests on intermittent failures like on a
connection error, timeout, or on certain API responses like a status 409
Conflict
. Idempotency keys are always added to requests to
make any such subsequent retries safe.
By default, it will perform up to two retries. That number can be configured
with StripeConfiguration.MaxNetworkRetries
:
StripeConfiguration.MaxNetworkRetries = 0; // Zero retries
How to use undocumented parameters and properties
stripe-dotnet is a typed library and it supports all public properties or parameters.
Stripe sometimes has beta which introduces new properties or parameters that are not immediately public. The library does not support these properties or parameters until they are public but there is still an approach that allows you to use them.
Parameters
To pass undocumented parameters to Stripe using stripe-dotnet you need to use the AddExtraParam()
method, as shown below:
var options = new CustomerCreateOptions
{
Email = "[email protected]"
}
options.AddExtraParam("secret_feature_enabled", "true");
options.AddExtraParam("secret_parameter[primary]", "primary value");
options.AddExtraParam("secret_parameter[secondary]", "secondary value");
var service = new CustomerService();
var customer = service.Create(options);
Properties
To retrieve undocumented properties from Stripe using C# you can use an option in the library to return the raw JSON object and return the property. An example of this is shown below:
var service = new CustomerService();
var customer = service.Get("cus_1234");
customer.RawJObject["secret_feature_enabled"];
customer.RawJObject["secret_parameter"]["primary"];
customer.RawJObject["secret_parameter"]["secondary"];
Writing a plugin
If you're writing a plugin that uses the library, we'd appreciate it if you
identified using StripeConfiguration.AppInfo
:
StripeConfiguration.AppInfo = new AppInfo
{
Name = "MyAwesomePlugin",
Url = "https://myawesomeplugin.info",
Version = "1.2.34",
};
This information is passed along when the library makes calls to the Stripe
API. Note that while Name
is always required, Url
and Version
are
optional.
Development
The test suite depends on stripe-mock, so make sure to fetch and run it from a background terminal (stripe-mock's README also contains instructions for installing via Homebrew and other methods):
go get -u github.com/stripe/stripe-mock
stripe-mock
Run all tests from the src/StripeTests
directory:
dotnet test
Run some tests, filtering by name:
dotnet test --filter FullyQualifiedName~InvoiceServiceTest
Run tests for a single target framework:
dotnet test --framework netcoreapp2.1
The library uses dotnet-format
for code formatting. Code
must be formatted before PRs are submitted, otherwise CI will fail. Run the
formatter with:
dotnet format src/Stripe.net.sln
For any requests, bug or comments, please open an issue or submit a pull request.