RechargeSharp 12.2.4
dotnet add package RechargeSharp --version 12.2.4
NuGet\Install-Package RechargeSharp -Version 12.2.4
<PackageReference Include="RechargeSharp" Version="12.2.4" />
paket add RechargeSharp --version 12.2.4
#r "nuget: RechargeSharp, 12.2.4"
// Install RechargeSharp as a Cake Addin #addin nuget:?package=RechargeSharp&version=12.2.4 // Install RechargeSharp as a Cake Tool #tool nuget:?package=RechargeSharp&version=12.2.4
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. |
.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
- Polly (>= 7.2.3)
- RechargeSharp.Entities (>= 12.2.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
12.2.4 | 741 | 10/8/2024 |
12.2.3 | 1,979 | 10/30/2023 |
12.2.2 | 1,898 | 11/8/2022 |
12.2.1 | 676 | 9/13/2022 |
12.2.0 | 916 | 9/13/2022 |
12.1.1 | 497 | 9/5/2022 |
12.1.1-alpha.2 | 303 | 7/27/2022 |
12.1.1-alpha.1 | 135 | 7/27/2022 |
12.1.0-alpha.3 | 128 | 7/27/2022 |
12.0.0-alpha.3 | 665 | 6/2/2022 |
12.0.0-alpha.2 | 128 | 6/2/2022 |
12.0.0-alpha.1 | 128 | 6/2/2022 |
11.2.0-alpha.2 | 126 | 5/24/2022 |
11.2.0-alpha.1 | 140 | 4/26/2022 |
11.1.0-beta.5 | 2,740 | 3/23/2022 |
11.1.0-beta.4 | 133 | 3/2/2022 |
11.1.0-beta.3 | 955 | 2/24/2022 |
11.1.0-beta.1 | 128 | 2/17/2022 |
11.0.1 | 747 | 2/9/2022 |
11.0.1-alpha.1 | 135 | 2/9/2022 |
11.0.0 | 491 | 2/7/2022 |
11.0.0-alpha.7 | 406 | 2/1/2022 |
11.0.0-alpha.6 | 149 | 1/10/2022 |
11.0.0-alpha.4 | 1,872 | 12/14/2021 |
11.0.0-alpha.3 | 162 | 12/12/2021 |
11.0.0-alpha.2 | 162 | 12/10/2021 |
10.0.0 | 554 | 12/8/2021 |
10.0.0-alpha.3 | 632 | 11/30/2021 |
10.0.0-alpha.2 | 421 | 11/23/2021 |
9.0.0 | 1,224 | 11/9/2021 |
9.0.0-alpha.2 | 527 | 10/8/2021 |
9.0.0-alpha.1 | 282 | 10/7/2021 |
8.1.0-alpha.3 | 383 | 10/1/2021 |
8.1.0-alpha.2 | 226 | 9/28/2021 |
8.1.0-alpha.1 | 162 | 9/27/2021 |
8.0.1 | 443 | 9/23/2021 |
7.0.0 | 532 | 9/8/2021 |
7.0.0-alpha.4 | 481 | 8/4/2021 |
7.0.0-alpha.3 | 200 | 8/3/2021 |
7.0.0-alpha.2 | 164 | 8/2/2021 |
7.0.0-alpha.1 | 186 | 8/2/2021 |
6.0.1 | 539 | 7/13/2021 |
6.0.0 | 467 | 7/12/2021 |
5.1.0 | 473 | 7/5/2021 |
5.0.0 | 785 | 6/9/2021 |
5.0.0-alpha.1 | 178 | 6/9/2021 |
4.6.0 | 734 | 5/20/2021 |
4.6.0-beta.2 | 204 | 5/13/2021 |
4.6.0-beta.1 | 188 | 5/13/2021 |
4.5.0 | 432 | 5/11/2021 |
4.5.0-beta.8 | 171 | 5/11/2021 |
4.5.0-beta.7 | 195 | 4/27/2021 |
4.5.0-beta.5 | 156 | 4/27/2021 |
4.5.0-beta.4 | 169 | 4/27/2021 |
4.5.0-beta.3 | 203 | 4/23/2021 |
4.5.0-beta.2 | 184 | 4/22/2021 |
4.5.0-beta.1 | 180 | 4/21/2021 |
4.4.6 | 591 | 4/12/2021 |
4.4.6-beta.1 | 176 | 4/12/2021 |
4.4.4 | 435 | 4/9/2021 |
4.4.4-beta.1 | 176 | 4/8/2021 |
4.4.3 | 504 | 4/5/2021 |
4.4.2 | 533 | 3/26/2021 |
4.4.1 | 624 | 3/14/2021 |
4.4.0 | 811 | 2/9/2021 |
4.3.2 | 416 | 1/27/2021 |
4.3.1 | 380 | 1/27/2021 |
4.3.0 | 466 | 1/20/2021 |
4.2.0 | 418 | 1/13/2021 |
4.1.4 | 430 | 12/29/2020 |
4.1.3 | 419 | 12/29/2020 |
4.1.2 | 496 | 12/21/2020 |
4.1.1 | 1,052 | 5/29/2020 |
4.1.0 | 534 | 5/29/2020 |
4.1.0-beta.1 | 280 | 5/27/2020 |
4.0.3-beta.2 | 331 | 5/11/2020 |
4.0.3-beta.1 | 287 | 5/11/2020 |
4.0.2 | 609 | 4/9/2020 |
4.0.1 | 617 | 3/25/2020 |
4.0.0 | 512 | 3/25/2020 |
4.0.0-beta.2 | 267 | 3/24/2020 |
4.0.0-beta.1 | 273 | 3/24/2020 |
3.2.8 | 544 | 3/23/2020 |
3.2.7 | 550 | 3/19/2020 |
3.2.6 | 553 | 3/9/2020 |
3.2.5 | 555 | 3/5/2020 |
3.2.4 | 544 | 3/4/2020 |
3.2.3 | 580 | 3/4/2020 |
3.2.2 | 529 | 3/4/2020 |
3.2.1 | 536 | 3/4/2020 |
3.2.0 | 587 | 3/4/2020 |
3.1.0 | 545 | 3/4/2020 |
3.0.10 | 555 | 2/27/2020 |
3.0.9 | 493 | 2/24/2020 |
3.0.7 | 513 | 2/24/2020 |
3.0.6 | 609 | 2/3/2020 |
3.0.5 | 549 | 2/3/2020 |
3.0.3 | 618 | 1/31/2020 |
3.0.1 | 560 | 1/13/2020 |
3.0.0 | 658 | 12/28/2019 |
2.2.9 | 613 | 12/13/2019 |
2.2.8 | 551 | 12/13/2019 |
2.2.7 | 665 | 11/21/2019 |
2.2.6 | 574 | 11/12/2019 |
2.2.5 | 548 | 11/8/2019 |
2.2.4 | 539 | 11/6/2019 |
2.2.3 | 548 | 11/6/2019 |
2.2.2 | 545 | 11/6/2019 |
2.2.1 | 544 | 11/6/2019 |
2.2.0 | 548 | 11/6/2019 |
2.1.1 | 528 | 11/1/2019 |
2.1.0 | 535 | 10/31/2019 |
2.0.1 | 575 | 10/29/2019 |
2.0.0 | 562 | 10/29/2019 |
1.5.0 | 550 | 10/25/2019 |
1.4.0 | 527 | 10/23/2019 |
1.3.0 | 548 | 10/16/2019 |
1.2.0 | 553 | 10/16/2019 |
1.1.4 | 535 | 10/9/2019 |
1.1.0 | 575 | 10/9/2019 |
1.0.0 | 561 | 9/18/2019 |
0.2.58 | 544 | 9/17/2019 |
0.2.57 | 593 | 9/16/2019 |
0.2.56 | 585 | 9/16/2019 |
0.2.55 | 792 | 9/16/2019 |
0.2.54 | 571 | 9/16/2019 |
0.2.53 | 586 | 9/16/2019 |
0.2.52 | 582 | 9/16/2019 |
0.2.51 | 563 | 9/13/2019 |
0.2.50 | 598 | 9/12/2019 |
0.2.49 | 579 | 9/12/2019 |
0.2.48 | 601 | 9/10/2019 |
0.2.47 | 574 | 9/10/2019 |
0.2.46 | 620 | 9/9/2019 |
0.2.43 | 594 | 9/7/2019 |
0.2.42 | 594 | 9/7/2019 |
0.2.37 | 586 | 9/7/2019 |
0.2.36 | 567 | 9/7/2019 |
0.2.35 | 582 | 9/7/2019 |
0.2.34 | 590 | 9/6/2019 |
0.2.33 | 559 | 9/5/2019 |
0.2.32 | 548 | 9/5/2019 |
0.2.31 | 562 | 9/5/2019 |
0.2.30 | 567 | 9/4/2019 |
0.2.25 | 582 | 9/4/2019 |
0.2.24 | 587 | 9/4/2019 |
0.2.23 | 544 | 9/3/2019 |
0.2.14 | 548 | 9/3/2019 |
0.2.13 | 570 | 9/3/2019 |
0.2.9 | 569 | 9/3/2019 |
0.2.8 | 545 | 9/3/2019 |
0.2.7 | 538 | 9/3/2019 |
0.2.6 | 556 | 9/3/2019 |
0.1.9 | 573 | 8/30/2019 |
0.1.8 | 597 | 8/15/2019 |
0.1.4 | 581 | 8/15/2019 |
0.1.3 | 543 | 8/15/2019 |
0.1.2 | 560 | 8/15/2019 |
0.1.1 | 535 | 8/15/2019 |
0.1.0 | 576 | 7/30/2019 |
0.0.32 | 582 | 7/26/2019 |
0.0.31 | 585 | 7/26/2019 |
0.0.24 | 577 | 7/25/2019 |
0.0.23 | 602 | 7/25/2019 |
0.0.22 | 552 | 7/25/2019 |
0.0.21 | 576 | 7/25/2019 |
0.0.20 | 562 | 7/25/2019 |
0.0.19 | 564 | 7/25/2019 |
0.0.18 | 591 | 7/25/2019 |
0.0.17 | 574 | 7/25/2019 |
0.0.16 | 609 | 7/23/2019 |
0.0.15 | 581 | 7/22/2019 |
0.0.14 | 636 | 7/22/2019 |
0.0.13 | 628 | 7/22/2019 |
0.0.12 | 576 | 7/22/2019 |
0.0.11 | 641 | 7/11/2019 |
0.0.10 | 625 | 7/10/2019 |
0.0.9 | 633 | 7/10/2019 |
0.0.8 | 596 | 7/9/2019 |
0.0.7 | 579 | 7/9/2019 |
0.0.6 | 585 | 7/9/2019 |
0.0.5 | 602 | 7/8/2019 |
0.0.4 | 599 | 7/8/2019 |
0.0.3 | 596 | 7/7/2019 |
0.0.2 | 578 | 7/4/2019 |
0.0.1 | 596 | 6/25/2019 |
Added missing storefront purchase option