RechargeSharp 4.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package RechargeSharp --version 4.4.2                
NuGet\Install-Package RechargeSharp -Version 4.4.2                
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="4.4.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RechargeSharp --version 4.4.2                
#r "nuget: RechargeSharp, 4.4.2"                
#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=4.4.2

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

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.4 360 10/8/2024
12.2.3 1,784 10/30/2023
12.2.2 1,672 11/8/2022
12.2.1 663 9/13/2022
12.2.0 905 9/13/2022
12.1.1 486 9/5/2022
12.1.1-alpha.2 297 7/27/2022
12.1.1-alpha.1 129 7/27/2022
12.1.0-alpha.3 122 7/27/2022
12.0.0-alpha.3 660 6/2/2022
12.0.0-alpha.2 122 6/2/2022
12.0.0-alpha.1 122 6/2/2022
11.2.0-alpha.2 120 5/24/2022
11.2.0-alpha.1 134 4/26/2022
11.1.0-beta.5 2,734 3/23/2022
11.1.0-beta.4 127 3/2/2022
11.1.0-beta.3 949 2/24/2022
11.1.0-beta.1 122 2/17/2022
11.0.1 736 2/9/2022
11.0.1-alpha.1 130 2/9/2022
11.0.0 480 2/7/2022
11.0.0-alpha.7 394 2/1/2022
11.0.0-alpha.6 143 1/10/2022
11.0.0-alpha.4 1,864 12/14/2021
11.0.0-alpha.3 154 12/12/2021
11.0.0-alpha.2 156 12/10/2021
10.0.0 543 12/8/2021
10.0.0-alpha.3 626 11/30/2021
10.0.0-alpha.2 413 11/23/2021
9.0.0 1,213 11/9/2021
9.0.0-alpha.2 522 10/8/2021
9.0.0-alpha.1 276 10/7/2021
8.1.0-alpha.3 377 10/1/2021
8.1.0-alpha.2 220 9/28/2021
8.1.0-alpha.1 154 9/27/2021
8.0.1 432 9/23/2021
7.0.0 520 9/8/2021
7.0.0-alpha.4 475 8/4/2021
7.0.0-alpha.3 195 8/3/2021
7.0.0-alpha.2 158 8/2/2021
7.0.0-alpha.1 178 8/2/2021
6.0.1 529 7/13/2021
6.0.0 457 7/12/2021
5.1.0 463 7/5/2021
5.0.0 775 6/9/2021
5.0.0-alpha.1 170 6/9/2021
4.6.0 724 5/20/2021
4.6.0-beta.2 198 5/13/2021
4.6.0-beta.1 182 5/13/2021
4.5.0 416 5/11/2021
4.5.0-beta.8 165 5/11/2021
4.5.0-beta.7 187 4/27/2021
4.5.0-beta.5 148 4/27/2021
4.5.0-beta.4 163 4/27/2021
4.5.0-beta.3 197 4/23/2021
4.5.0-beta.2 174 4/22/2021
4.5.0-beta.1 172 4/21/2021
4.4.6 579 4/12/2021
4.4.6-beta.1 170 4/12/2021
4.4.4 425 4/9/2021
4.4.4-beta.1 168 4/8/2021
4.4.3 492 4/5/2021
4.4.2 521 3/26/2021
4.4.1 612 3/14/2021
4.4.0 801 2/9/2021
4.3.2 404 1/27/2021
4.3.1 370 1/27/2021
4.3.0 455 1/20/2021
4.2.0 406 1/13/2021
4.1.4 419 12/29/2020
4.1.3 405 12/29/2020
4.1.2 484 12/21/2020
4.1.1 1,039 5/29/2020
4.1.0 522 5/29/2020
4.1.0-beta.1 272 5/27/2020
4.0.3-beta.2 323 5/11/2020
4.0.3-beta.1 278 5/11/2020
4.0.2 597 4/9/2020
4.0.1 605 3/25/2020
4.0.0 500 3/25/2020
4.0.0-beta.2 260 3/24/2020
4.0.0-beta.1 265 3/24/2020
3.2.8 530 3/23/2020
3.2.7 538 3/19/2020
3.2.6 543 3/9/2020
3.2.5 545 3/5/2020
3.2.4 532 3/4/2020
3.2.3 568 3/4/2020
3.2.2 517 3/4/2020
3.2.1 522 3/4/2020
3.2.0 575 3/4/2020
3.1.0 533 3/4/2020
3.0.10 542 2/27/2020
3.0.9 481 2/24/2020
3.0.7 503 2/24/2020
3.0.6 599 2/3/2020
3.0.5 536 2/3/2020
3.0.3 606 1/31/2020
3.0.1 547 1/13/2020
3.0.0 646 12/28/2019
2.2.9 602 12/13/2019
2.2.8 539 12/13/2019
2.2.7 652 11/21/2019
2.2.6 562 11/12/2019
2.2.5 536 11/8/2019
2.2.4 527 11/6/2019
2.2.3 534 11/6/2019
2.2.2 535 11/6/2019
2.2.1 534 11/6/2019
2.2.0 536 11/6/2019
2.1.1 516 11/1/2019
2.1.0 521 10/31/2019
2.0.1 561 10/29/2019
2.0.0 550 10/29/2019
1.5.0 538 10/25/2019
1.4.0 517 10/23/2019
1.3.0 537 10/16/2019
1.2.0 541 10/16/2019
1.1.4 523 10/9/2019
1.1.0 563 10/9/2019
1.0.0 548 9/18/2019
0.2.58 532 9/17/2019
0.2.57 579 9/16/2019
0.2.56 574 9/16/2019
0.2.55 779 9/16/2019
0.2.54 558 9/16/2019
0.2.53 574 9/16/2019
0.2.52 570 9/16/2019
0.2.51 550 9/13/2019
0.2.50 586 9/12/2019
0.2.49 567 9/12/2019
0.2.48 588 9/10/2019
0.2.47 563 9/10/2019
0.2.46 607 9/9/2019
0.2.43 584 9/7/2019
0.2.42 584 9/7/2019
0.2.37 573 9/7/2019
0.2.36 555 9/7/2019
0.2.35 572 9/7/2019
0.2.34 579 9/6/2019
0.2.33 548 9/5/2019
0.2.32 537 9/5/2019
0.2.31 551 9/5/2019
0.2.30 556 9/4/2019
0.2.25 567 9/4/2019
0.2.24 576 9/4/2019
0.2.23 533 9/3/2019
0.2.14 537 9/3/2019
0.2.13 559 9/3/2019
0.2.9 558 9/3/2019
0.2.8 534 9/3/2019
0.2.7 528 9/3/2019
0.2.6 546 9/3/2019
0.1.9 562 8/30/2019
0.1.8 586 8/15/2019
0.1.4 570 8/15/2019
0.1.3 530 8/15/2019
0.1.2 549 8/15/2019
0.1.1 522 8/15/2019
0.1.0 566 7/30/2019
0.0.32 571 7/26/2019
0.0.31 574 7/26/2019
0.0.24 565 7/25/2019
0.0.23 592 7/25/2019
0.0.22 541 7/25/2019
0.0.21 566 7/25/2019
0.0.20 552 7/25/2019
0.0.19 554 7/25/2019
0.0.18 581 7/25/2019
0.0.17 564 7/25/2019
0.0.16 599 7/23/2019
0.0.15 570 7/22/2019
0.0.14 626 7/22/2019
0.0.13 617 7/22/2019
0.0.12 566 7/22/2019
0.0.11 630 7/11/2019
0.0.10 615 7/10/2019
0.0.9 623 7/10/2019
0.0.8 586 7/9/2019
0.0.7 570 7/9/2019
0.0.6 575 7/9/2019
0.0.5 592 7/8/2019
0.0.4 589 7/8/2019
0.0.3 586 7/7/2019
0.0.2 568 7/4/2019
0.0.1 586 6/25/2019

Updated newtonsoft, fixed api key snippet when reporting unauthorized response