RechargeSharp 8.0.1

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

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

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 677 10/8/2024
12.2.3 1,870 10/30/2023
12.2.2 1,852 11/8/2022
12.2.1 674 9/13/2022
12.2.0 914 9/13/2022
12.1.1 495 9/5/2022
12.1.1-alpha.2 301 7/27/2022
12.1.1-alpha.1 133 7/27/2022
12.1.0-alpha.3 126 7/27/2022
12.0.0-alpha.3 664 6/2/2022
12.0.0-alpha.2 126 6/2/2022
12.0.0-alpha.1 126 6/2/2022
11.2.0-alpha.2 124 5/24/2022
11.2.0-alpha.1 138 4/26/2022
11.1.0-beta.5 2,738 3/23/2022
11.1.0-beta.4 131 3/2/2022
11.1.0-beta.3 953 2/24/2022
11.1.0-beta.1 126 2/17/2022
11.0.1 745 2/9/2022
11.0.1-alpha.1 134 2/9/2022
11.0.0 489 2/7/2022
11.0.0-alpha.7 404 2/1/2022
11.0.0-alpha.6 147 1/10/2022
11.0.0-alpha.4 1,870 12/14/2021
11.0.0-alpha.3 160 12/12/2021
11.0.0-alpha.2 160 12/10/2021
10.0.0 552 12/8/2021
10.0.0-alpha.3 630 11/30/2021
10.0.0-alpha.2 419 11/23/2021
9.0.0 1,222 11/9/2021
9.0.0-alpha.2 526 10/8/2021
9.0.0-alpha.1 280 10/7/2021
8.1.0-alpha.3 381 10/1/2021
8.1.0-alpha.2 224 9/28/2021
8.1.0-alpha.1 160 9/27/2021
8.0.1 441 9/23/2021
7.0.0 530 9/8/2021
7.0.0-alpha.4 479 8/4/2021
7.0.0-alpha.3 199 8/3/2021
7.0.0-alpha.2 162 8/2/2021
7.0.0-alpha.1 184 8/2/2021
6.0.1 537 7/13/2021
6.0.0 465 7/12/2021
5.1.0 471 7/5/2021
5.0.0 783 6/9/2021
5.0.0-alpha.1 174 6/9/2021
4.6.0 732 5/20/2021
4.6.0-beta.2 202 5/13/2021
4.6.0-beta.1 186 5/13/2021
4.5.0 430 5/11/2021
4.5.0-beta.8 169 5/11/2021
4.5.0-beta.7 191 4/27/2021
4.5.0-beta.5 154 4/27/2021
4.5.0-beta.4 167 4/27/2021
4.5.0-beta.3 201 4/23/2021
4.5.0-beta.2 182 4/22/2021
4.5.0-beta.1 176 4/21/2021
4.4.6 589 4/12/2021
4.4.6-beta.1 174 4/12/2021
4.4.4 433 4/9/2021
4.4.4-beta.1 172 4/8/2021
4.4.3 502 4/5/2021
4.4.2 531 3/26/2021
4.4.1 622 3/14/2021
4.4.0 809 2/9/2021
4.3.2 412 1/27/2021
4.3.1 378 1/27/2021
4.3.0 464 1/20/2021
4.2.0 416 1/13/2021
4.1.4 427 12/29/2020
4.1.3 417 12/29/2020
4.1.2 492 12/21/2020
4.1.1 1,047 5/29/2020
4.1.0 532 5/29/2020
4.1.0-beta.1 276 5/27/2020
4.0.3-beta.2 329 5/11/2020
4.0.3-beta.1 282 5/11/2020
4.0.2 605 4/9/2020
4.0.1 614 3/25/2020
4.0.0 509 3/25/2020
4.0.0-beta.2 267 3/24/2020
4.0.0-beta.1 272 3/24/2020
3.2.8 543 3/23/2020
3.2.7 547 3/19/2020
3.2.6 552 3/9/2020
3.2.5 554 3/5/2020
3.2.4 543 3/4/2020
3.2.3 577 3/4/2020
3.2.2 528 3/4/2020
3.2.1 535 3/4/2020
3.2.0 586 3/4/2020
3.1.0 544 3/4/2020
3.0.10 552 2/27/2020
3.0.9 492 2/24/2020
3.0.7 512 2/24/2020
3.0.6 608 2/3/2020
3.0.5 546 2/3/2020
3.0.3 615 1/31/2020
3.0.1 559 1/13/2020
3.0.0 655 12/28/2019
2.2.9 613 12/13/2019
2.2.8 548 12/13/2019
2.2.7 662 11/21/2019
2.2.6 573 11/12/2019
2.2.5 547 11/8/2019
2.2.4 536 11/6/2019
2.2.3 547 11/6/2019
2.2.2 544 11/6/2019
2.2.1 543 11/6/2019
2.2.0 547 11/6/2019
2.1.1 527 11/1/2019
2.1.0 534 10/31/2019
2.0.1 574 10/29/2019
2.0.0 559 10/29/2019
1.5.0 549 10/25/2019
1.4.0 526 10/23/2019
1.3.0 546 10/16/2019
1.2.0 550 10/16/2019
1.1.4 532 10/9/2019
1.1.0 574 10/9/2019
1.0.0 560 9/18/2019
0.2.58 543 9/17/2019
0.2.57 592 9/16/2019
0.2.56 584 9/16/2019
0.2.55 789 9/16/2019
0.2.54 568 9/16/2019
0.2.53 583 9/16/2019
0.2.52 581 9/16/2019
0.2.51 560 9/13/2019
0.2.50 597 9/12/2019
0.2.49 576 9/12/2019
0.2.48 600 9/10/2019
0.2.47 573 9/10/2019
0.2.46 617 9/9/2019
0.2.43 593 9/7/2019
0.2.42 593 9/7/2019
0.2.37 585 9/7/2019
0.2.36 566 9/7/2019
0.2.35 582 9/7/2019
0.2.34 589 9/6/2019
0.2.33 558 9/5/2019
0.2.32 547 9/5/2019
0.2.31 561 9/5/2019
0.2.30 566 9/4/2019
0.2.25 581 9/4/2019
0.2.24 586 9/4/2019
0.2.23 543 9/3/2019
0.2.14 547 9/3/2019
0.2.13 569 9/3/2019
0.2.9 568 9/3/2019
0.2.8 544 9/3/2019
0.2.7 537 9/3/2019
0.2.6 555 9/3/2019
0.1.9 572 8/30/2019
0.1.8 596 8/15/2019
0.1.4 580 8/15/2019
0.1.3 542 8/15/2019
0.1.2 559 8/15/2019
0.1.1 534 8/15/2019
0.1.0 575 7/30/2019
0.0.32 581 7/26/2019
0.0.31 584 7/26/2019
0.0.24 576 7/25/2019
0.0.23 601 7/25/2019
0.0.22 551 7/25/2019
0.0.21 575 7/25/2019
0.0.20 561 7/25/2019
0.0.19 563 7/25/2019
0.0.18 590 7/25/2019
0.0.17 573 7/25/2019
0.0.16 608 7/23/2019
0.0.15 580 7/22/2019
0.0.14 636 7/22/2019
0.0.13 627 7/22/2019
0.0.12 575 7/22/2019
0.0.11 640 7/11/2019
0.0.10 624 7/10/2019
0.0.9 632 7/10/2019
0.0.8 595 7/9/2019
0.0.7 579 7/9/2019
0.0.6 584 7/9/2019
0.0.5 601 7/8/2019
0.0.4 598 7/8/2019
0.0.3 595 7/7/2019
0.0.2 577 7/4/2019
0.0.1 595 6/25/2019

Fixed equality bug