RechargeSharp.Entities
12.2.6
dotnet add package RechargeSharp.Entities --version 12.2.6
NuGet\Install-Package RechargeSharp.Entities -Version 12.2.6
<PackageReference Include="RechargeSharp.Entities" Version="12.2.6" />
<PackageVersion Include="RechargeSharp.Entities" Version="12.2.6" />
<PackageReference Include="RechargeSharp.Entities" />
paket add RechargeSharp.Entities --version 12.2.6
#r "nuget: RechargeSharp.Entities, 12.2.6"
#:package RechargeSharp.Entities@12.2.6
#addin nuget:?package=RechargeSharp.Entities&version=12.2.6
#tool nuget:?package=RechargeSharp.Entities&version=12.2.6
RechargeSharp, a C# library for RechargePayments
Get it here https://www.nuget.org/packages/RechargeSharp/
Built to work with the api documented at https://developer.rechargepayments.com/
Please feel free to submit issues and pull requests on github
Supported API versions
- 2021-01: The namespace for this is just
RechargeSharp. - 2021-11: The namespace for this is
RechargeSharp.v2021-11.
You can use services from both namespaces simultaneously without issues.
Recharge API version 2021-11
Quickstart
Dependency injection
Use the AddRechargeSharp2021_11() to add the services to the service collection, like so:
var hostBuilder = Host.CreateDefaultBuilder()
.ConfigureServices(collection =>
{
var apiKey = "<insert-your-API-key-here>";
collection.AddRechargeSharp2021_11(options => options.ApiKey = apiKey);
});
After this, the DI container will be able to resolve services for implemented endpoints, such as the IAddressService, ICustomerService, and so on.
Here is a tiny example of a class that uses the ICustomerService.
private readonly ICustomerService _customerService;
public YourServiceThatUsesRechargeSharp(ICustomerService customerService)
{
_customerService = customerService;
}
protected async Task PrintCustomerEmail()
{
GetCustomerTypes.Response? response = await _customerService.GetCustomerAsync(1234);
Console.WriteLine($"Customer email: {response!.Customer!.Email}");
}
Recharge API version 2021-01
Quickstart
Dependency injection
If you set up your appsettings.json like this:
{
"RechargeConfiguration": {
"ApiKey": [
"1",
"2",
"3",
"4"
]
}
}
Add RechargeSharp to dependency injection. After that the services will be constructor injected.
// this example shows how you can get a list of api keys from configuration that the services will swap between automatically when encountering throttling.
services.AddRechargeSharp(opts =>
{
opts.ApiKeyArray = _configuration.GetSection("RechargeConfiguration:ApiKey").GetChildren().Select(x => x.Value).ToArray();
opts.WebhookApiKey = _configuration["RechargeConfiguration:ApiKey:0"];
})
// if you only have 1 api key you wish to work with you can do the following.
services.AddRechargeSharp(opts =>
{
opts.ApiKeyArray = new[] { "apikey" });
opts.WebhookApiKey = "apikey";
}
Subscriptions
public class SubscriptionTestClass {
private readonly SubscriptionService _subscriptionService;
// constructor inject the subscription service to start working with subscriptions.
public SubscriptionTestClass(SubscriptionService subscriptionService){
_subscriptionService = subscriptionService;
}
public async Task DoStuff(){
// get all subscriptions with status ACTIVE and created after two months ago.
var subscriptions = await subscriptionService.GetAllSubscriptionsWithParamsAsync(status: "ACTIVE", createdAtMin: DateTime.Today.AddMonths(-2));
// iterate results and print subscription Id.
foreach (var subscription in subscriptions)
{
Console.WriteLine(subscription.Id);
}
}
}
Customers
public class CustomerTestClass {
private readonly CustomerService _customerService;
// constructor inject the customer service to start working with customers.
public CustomerTestClass(CustomerService customerService){
_customerService = customerService;
}
public async Task DoStuff(){
// get all customers created in the last two days.
var customers = await _customerService.GetAllCustomersWithParamsAsync(createdAtMin: DateTime.Now.AddDays(-2));
// iterate results and print whether the customer has a valid payment method.
foreach (var customer in customers)
{
Console.WriteLine(customer.HasValidPaymentMethod);
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Http (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.2)
- NuGet.Versioning (>= 6.4.0)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on RechargeSharp.Entities:
| Package | Downloads |
|---|---|
|
RechargeSharp
A C# library for RechargePayments |
|
|
RechargeSharp.Entities.EntityFrameworkCore
A C# library for RechargePayments |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 12.2.6 | 290 | 7/6/2025 |
| 12.2.5 | 275 | 7/5/2025 |
| 12.2.4 | 1,112 | 10/8/2024 |
| 12.2.3 | 3,283 | 10/30/2023 |
| 12.2.2 | 3,581 | 11/8/2022 |
| 12.2.1 | 1,333 | 9/13/2022 |
| 12.2.0 | 1,594 | 9/13/2022 |
| 12.1.1 | 1,323 | 9/5/2022 |
| 12.1.0-alpha.2 | 477 | 7/27/2022 |
| 12.1.0-alpha.1 | 211 | 7/27/2022 |
| 12.0.0-alpha.1 | 914 | 6/2/2022 |
| 11.2.0-alpha.2 | 473 | 5/24/2022 |
| 11.2.0-alpha.1 | 238 | 4/26/2022 |
| 11.1.0-beta.5 | 2,831 | 3/23/2022 |
| 11.1.0-beta.4 | 3,343 | 3/2/2022 |
| 11.1.0-beta.3 | 1,059 | 2/24/2022 |
| 11.1.0-beta.2 | 231 | 2/17/2022 |
| 11.1.0-beta.1 | 438 | 2/17/2022 |
| 11.1.0-alpha.3 | 231 | 2/17/2022 |
| 11.1.0-alpha.2 | 226 | 2/17/2022 |
| 11.0.0 | 1,748 | 2/7/2022 |
| 11.0.0-alpha.6 | 517 | 1/10/2022 |
| 11.0.0-alpha.4 | 2,083 | 12/14/2021 |
| 11.0.0-alpha.3 | 414 | 12/12/2021 |
| 11.0.0-alpha.2 | 261 | 12/10/2021 |
| 11.0.0-alpha.1 | 251 | 12/10/2021 |
| 10.0.0 | 815 | 12/8/2021 |
| 10.0.0-alpha.3 | 729 | 11/30/2021 |
| 10.0.0-alpha.2 | 516 | 11/23/2021 |
| 10.0.0-alpha.1 | 254 | 11/23/2021 |
Added missing storefront purchase option