RechargeSharp 9.0.0-alpha.1

This is a prerelease version of RechargeSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package RechargeSharp --version 9.0.0-alpha.1
                    
NuGet\Install-Package RechargeSharp -Version 9.0.0-alpha.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="9.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RechargeSharp" Version="9.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="RechargeSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RechargeSharp --version 9.0.0-alpha.1
                    
#r "nuget: RechargeSharp, 9.0.0-alpha.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.
#:package RechargeSharp@9.0.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RechargeSharp&version=9.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RechargeSharp&version=9.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

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.  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. 
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.6 196 7/6/2025
12.2.5 182 7/5/2025
12.2.4 964 10/8/2024
12.2.3 3,144 10/30/2023
12.2.2 3,028 11/8/2022
12.2.1 777 9/13/2022
12.2.0 1,017 9/13/2022
12.1.1 603 9/5/2022
12.1.1-alpha.2 382 7/27/2022
12.1.1-alpha.1 211 7/27/2022
12.1.0-alpha.3 212 7/27/2022
12.0.0-alpha.3 752 6/2/2022
12.0.0-alpha.2 219 6/2/2022
12.0.0-alpha.1 210 6/2/2022
11.2.0-alpha.2 217 5/24/2022
11.2.0-alpha.1 241 4/26/2022
11.1.0-beta.5 2,835 3/23/2022
11.1.0-beta.4 229 3/2/2022
11.1.0-beta.3 1,053 2/24/2022
11.1.0-beta.1 227 2/17/2022
11.0.1 867 2/9/2022
11.0.1-alpha.1 235 2/9/2022
11.0.0 608 2/7/2022
11.0.0-alpha.7 500 2/1/2022
11.0.0-alpha.6 245 1/10/2022
11.0.0-alpha.4 1,970 12/14/2021
11.0.0-alpha.3 263 12/12/2021
11.0.0-alpha.2 257 12/10/2021
10.0.0 677 12/8/2021
10.0.0-alpha.3 726 11/30/2021
10.0.0-alpha.2 519 11/23/2021
9.0.0 1,344 11/9/2021
9.0.0-alpha.2 623 10/8/2021
9.0.0-alpha.1 379 10/7/2021
8.1.0-alpha.3 477 10/1/2021
8.1.0-alpha.2 321 9/28/2021
8.1.0-alpha.1 254 9/27/2021
8.0.1 564 9/23/2021
7.0.0 650 9/8/2021
7.0.0-alpha.4 578 8/4/2021
7.0.0-alpha.3 297 8/3/2021
7.0.0-alpha.2 260 8/2/2021
7.0.0-alpha.1 285 8/2/2021
6.0.1 657 7/13/2021
6.0.0 586 7/12/2021
5.1.0 592 7/5/2021
5.0.0 903 6/9/2021
5.0.0-alpha.1 273 6/9/2021
4.6.0 846 5/20/2021
4.6.0-beta.2 297 5/13/2021
4.6.0-beta.1 285 5/13/2021
4.5.0 550 5/11/2021
4.5.0-beta.8 269 5/11/2021
4.5.0-beta.7 305 4/27/2021
4.5.0-beta.5 258 4/27/2021
4.5.0-beta.4 275 4/27/2021
4.5.0-beta.3 306 4/23/2021
4.5.0-beta.2 287 4/22/2021
4.5.0-beta.1 277 4/21/2021
4.4.6 714 4/12/2021
4.4.6-beta.1 280 4/12/2021
4.4.4 560 4/9/2021
4.4.4-beta.1 274 4/8/2021
4.4.3 628 4/5/2021
4.4.2 664 3/26/2021
4.4.1 754 3/14/2021
4.4.0 948 2/9/2021
4.3.2 548 1/27/2021
4.3.1 510 1/27/2021
4.3.0 593 1/20/2021
4.2.0 540 1/13/2021
4.1.4 566 12/29/2020
4.1.3 549 12/29/2020
4.1.2 631 12/21/2020
4.1.1 1,189 5/29/2020
4.1.0 674 5/29/2020
4.1.0-beta.1 401 5/27/2020
4.0.3-beta.2 449 5/11/2020
4.0.3-beta.1 402 5/11/2020
4.0.2 747 4/9/2020
4.0.1 758 3/25/2020
4.0.0 652 3/25/2020
4.0.0-beta.2 380 3/24/2020
4.0.0-beta.1 388 3/24/2020
3.2.8 685 3/23/2020
3.2.7 687 3/19/2020
3.2.6 696 3/9/2020
3.2.5 703 3/5/2020
3.2.4 691 3/4/2020
3.2.3 720 3/4/2020
3.2.2 670 3/4/2020
3.2.1 678 3/4/2020
3.2.0 736 3/4/2020
3.1.0 692 3/4/2020
3.0.10 696 2/27/2020
3.0.9 641 2/24/2020
3.0.7 656 2/24/2020
3.0.6 748 2/3/2020
3.0.5 691 2/3/2020
3.0.3 758 1/31/2020
3.0.1 704 1/13/2020
3.0.0 798 12/28/2019
2.2.9 757 12/13/2019
2.2.8 693 12/13/2019
2.2.7 806 11/21/2019
2.2.6 712 11/12/2019
2.2.5 694 11/8/2019
2.2.4 679 11/6/2019
2.2.3 678 11/6/2019
2.2.2 688 11/6/2019
2.2.1 694 11/6/2019
2.2.0 694 11/6/2019
2.1.1 670 11/1/2019
2.1.0 677 10/31/2019
2.0.1 723 10/29/2019
2.0.0 706 10/29/2019
1.5.0 691 10/25/2019
1.4.0 668 10/23/2019
1.3.0 699 10/16/2019
1.2.0 702 10/16/2019
1.1.4 679 10/9/2019
1.1.0 707 10/9/2019
1.0.0 704 9/18/2019
0.2.58 693 9/17/2019
0.2.57 735 9/16/2019
0.2.56 731 9/16/2019
0.2.55 957 9/16/2019
0.2.54 717 9/16/2019
0.2.53 732 9/16/2019
0.2.52 728 9/16/2019
0.2.51 694 9/13/2019
0.2.50 745 9/12/2019
0.2.49 723 9/12/2019
0.2.48 745 9/10/2019
0.2.47 718 9/10/2019
0.2.46 769 9/9/2019
0.2.43 738 9/7/2019
0.2.42 742 9/7/2019
0.2.37 735 9/7/2019
0.2.36 715 9/7/2019
0.2.35 719 9/7/2019
0.2.34 747 9/6/2019
0.2.33 703 9/5/2019
0.2.32 682 9/5/2019
0.2.31 697 9/5/2019
0.2.30 717 9/4/2019
0.2.25 727 9/4/2019
0.2.24 730 9/4/2019
0.2.23 689 9/3/2019
0.2.14 692 9/3/2019
0.2.13 703 9/3/2019
0.2.9 710 9/3/2019
0.2.8 692 9/3/2019
0.2.7 681 9/3/2019
0.2.6 711 9/3/2019
0.1.9 720 8/30/2019
0.1.8 742 8/15/2019
0.1.4 729 8/15/2019
0.1.3 688 8/15/2019
0.1.2 705 8/15/2019
0.1.1 677 8/15/2019
0.1.0 726 7/30/2019
0.0.32 725 7/26/2019
0.0.31 730 7/26/2019
0.0.24 721 7/25/2019
0.0.23 744 7/25/2019
0.0.22 696 7/25/2019
0.0.21 723 7/25/2019
0.0.20 708 7/25/2019
0.0.19 698 7/25/2019
0.0.18 737 7/25/2019
0.0.17 718 7/25/2019
0.0.16 754 7/23/2019
0.0.15 729 7/22/2019
0.0.14 786 7/22/2019
0.0.13 775 7/22/2019
0.0.12 718 7/22/2019
0.0.11 785 7/11/2019
0.0.10 776 7/10/2019
0.0.9 775 7/10/2019
0.0.8 758 7/9/2019
0.0.7 723 7/9/2019
0.0.6 731 7/9/2019
0.0.5 745 7/8/2019
0.0.4 744 7/8/2019
0.0.3 736 7/7/2019
0.0.2 722 7/4/2019
0.0.1 742 6/25/2019

Replaced all DateTimes with DateTimeOffsets