RechargeSharp 5.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RechargeSharp --version 5.0.0                
NuGet\Install-Package RechargeSharp -Version 5.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RechargeSharp" Version="5.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RechargeSharp --version 5.0.0                
#r "nuget: RechargeSharp, 5.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RechargeSharp as a Cake Addin
#addin nuget:?package=RechargeSharp&version=5.0.0

// Install RechargeSharp as a Cake Tool
#tool nuget:?package=RechargeSharp&version=5.0.0                

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

Quickstart

Dependency injection

If you set up your appsettings.json like this:

{  
    "RechargeConfiguration": {
    "ApiKey": [
      "1",
      "2",
      "3",
      "4"
    ],
    "Url": "https://api.rechargeapps.com/"
  }
}

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 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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3 1,575 10/30/2023
12.2.2 1,474 11/8/2022
12.2.1 661 9/13/2022
12.2.0 901 9/13/2022
12.1.1 483 9/5/2022
12.1.1-alpha.2 292 7/27/2022
12.1.1-alpha.1 124 7/27/2022
12.1.0-alpha.3 118 7/27/2022
12.0.0-alpha.3 654 6/2/2022
12.0.0-alpha.2 115 6/2/2022
12.0.0-alpha.1 118 6/2/2022
11.2.0-alpha.2 114 5/24/2022
11.2.0-alpha.1 130 4/26/2022
11.1.0-beta.5 2,730 3/23/2022
11.1.0-beta.4 123 3/2/2022
11.1.0-beta.3 945 2/24/2022
11.1.0-beta.1 118 2/17/2022
11.0.1 733 2/9/2022
11.0.1-alpha.1 123 2/9/2022
11.0.0 478 2/7/2022
11.0.0-alpha.7 390 2/1/2022
11.0.0-alpha.6 137 1/10/2022
11.0.0-alpha.4 1,860 12/14/2021
11.0.0-alpha.3 148 12/12/2021
11.0.0-alpha.2 152 12/10/2021
10.0.0 541 12/8/2021
10.0.0-alpha.3 621 11/30/2021
10.0.0-alpha.2 403 11/23/2021
9.0.0 1,209 11/9/2021
9.0.0-alpha.2 518 10/8/2021
9.0.0-alpha.1 270 10/7/2021
8.1.0-alpha.3 372 10/1/2021
8.1.0-alpha.2 216 9/28/2021
8.1.0-alpha.1 150 9/27/2021
8.0.1 430 9/23/2021
7.0.0 518 9/8/2021
7.0.0-alpha.4 471 8/4/2021
7.0.0-alpha.3 189 8/3/2021
7.0.0-alpha.2 152 8/2/2021
7.0.0-alpha.1 174 8/2/2021
6.0.1 527 7/13/2021
6.0.0 453 7/12/2021
5.1.0 454 7/5/2021
5.0.0 771 6/9/2021
5.0.0-alpha.1 164 6/9/2021
4.6.0 716 5/20/2021
4.6.0-beta.2 191 5/13/2021
4.6.0-beta.1 176 5/13/2021
4.5.0 414 5/11/2021
4.5.0-beta.8 161 5/11/2021
4.5.0-beta.7 183 4/27/2021
4.5.0-beta.5 144 4/27/2021
4.5.0-beta.4 158 4/27/2021
4.5.0-beta.3 193 4/23/2021
4.5.0-beta.2 170 4/22/2021
4.5.0-beta.1 168 4/21/2021
4.4.6 577 4/12/2021
4.4.6-beta.1 166 4/12/2021
4.4.4 423 4/9/2021
4.4.4-beta.1 164 4/8/2021
4.4.3 490 4/5/2021
4.4.2 519 3/26/2021
4.4.1 610 3/14/2021
4.4.0 799 2/9/2021
4.3.2 402 1/27/2021
4.3.1 368 1/27/2021
4.3.0 452 1/20/2021
4.2.0 404 1/13/2021
4.1.4 417 12/29/2020
4.1.3 403 12/29/2020
4.1.2 481 12/21/2020
4.1.1 1,036 5/29/2020
4.1.0 518 5/29/2020
4.1.0-beta.1 267 5/27/2020
4.0.3-beta.2 318 5/11/2020
4.0.3-beta.1 273 5/11/2020
4.0.2 595 4/9/2020
4.0.1 603 3/25/2020
4.0.0 498 3/25/2020
4.0.0-beta.2 256 3/24/2020
4.0.0-beta.1 261 3/24/2020
3.2.8 528 3/23/2020
3.2.7 536 3/19/2020
3.2.6 541 3/9/2020
3.2.5 543 3/5/2020
3.2.4 530 3/4/2020
3.2.3 566 3/4/2020
3.2.2 515 3/4/2020
3.2.1 520 3/4/2020
3.2.0 572 3/4/2020
3.1.0 531 3/4/2020
3.0.10 540 2/27/2020
3.0.9 479 2/24/2020
3.0.7 501 2/24/2020
3.0.6 597 2/3/2020
3.0.5 534 2/3/2020
3.0.3 604 1/31/2020
3.0.1 545 1/13/2020
3.0.0 643 12/28/2019
2.2.9 600 12/13/2019
2.2.8 537 12/13/2019
2.2.7 650 11/21/2019
2.2.6 560 11/12/2019
2.2.5 534 11/8/2019
2.2.4 525 11/6/2019
2.2.3 532 11/6/2019
2.2.2 532 11/6/2019
2.2.1 532 11/6/2019
2.2.0 534 11/6/2019
2.1.1 513 11/1/2019
2.1.0 519 10/31/2019
2.0.1 559 10/29/2019
2.0.0 547 10/29/2019
1.5.0 536 10/25/2019
1.4.0 514 10/23/2019
1.3.0 535 10/16/2019
1.2.0 539 10/16/2019
1.1.4 521 10/9/2019
1.1.0 561 10/9/2019
1.0.0 546 9/18/2019
0.2.58 529 9/17/2019
0.2.57 577 9/16/2019
0.2.56 571 9/16/2019
0.2.55 772 9/16/2019
0.2.54 556 9/16/2019
0.2.53 572 9/16/2019
0.2.52 568 9/16/2019
0.2.51 547 9/13/2019
0.2.50 584 9/12/2019
0.2.49 565 9/12/2019
0.2.48 586 9/10/2019
0.2.47 561 9/10/2019
0.2.46 605 9/9/2019
0.2.43 581 9/7/2019
0.2.42 581 9/7/2019
0.2.37 569 9/7/2019
0.2.36 553 9/7/2019
0.2.35 569 9/7/2019
0.2.34 577 9/6/2019
0.2.33 546 9/5/2019
0.2.32 535 9/5/2019
0.2.31 549 9/5/2019
0.2.30 554 9/4/2019
0.2.25 565 9/4/2019
0.2.24 574 9/4/2019
0.2.23 531 9/3/2019
0.2.14 535 9/3/2019
0.2.13 558 9/3/2019
0.2.9 554 9/3/2019
0.2.8 532 9/3/2019
0.2.7 521 9/3/2019
0.2.6 543 9/3/2019
0.1.9 558 8/30/2019
0.1.8 583 8/15/2019
0.1.4 566 8/15/2019
0.1.3 528 8/15/2019
0.1.2 547 8/15/2019
0.1.1 514 8/15/2019
0.1.0 564 7/30/2019
0.0.32 568 7/26/2019
0.0.31 570 7/26/2019
0.0.24 563 7/25/2019
0.0.23 590 7/25/2019
0.0.22 539 7/25/2019
0.0.21 561 7/25/2019
0.0.20 550 7/25/2019
0.0.19 552 7/25/2019
0.0.18 579 7/25/2019
0.0.17 560 7/25/2019
0.0.16 597 7/23/2019
0.0.15 566 7/22/2019
0.0.14 617 7/22/2019
0.0.13 614 7/22/2019
0.0.12 562 7/22/2019
0.0.11 626 7/11/2019
0.0.10 613 7/10/2019
0.0.9 620 7/10/2019
0.0.8 582 7/9/2019
0.0.7 568 7/9/2019
0.0.6 565 7/9/2019
0.0.5 590 7/8/2019
0.0.4 584 7/8/2019
0.0.3 582 7/7/2019
0.0.2 564 7/4/2019
0.0.1 582 6/25/2019

Changed how onetimes work, added the field "add_to_next_charge" to create onetimes request.