payload-api
1.0.3
See the version list below for details.
dotnet add package payload-api --version 1.0.3
NuGet\Install-Package payload-api -Version 1.0.3
<PackageReference Include="payload-api" Version="1.0.3" />
paket add payload-api --version 1.0.3
#r "nuget: payload-api, 1.0.3"
// Install payload-api as a Cake Addin #addin nuget:?package=payload-api&version=1.0.3 // Install payload-api as a Cake Tool #tool nuget:?package=payload-api&version=1.0.3
Payload C# Library
A C# library for integrating Payload.
Installation
1) Download
Download the latest version from GitHub.
2) Include in Project
Include the Payload folder in your Visual Studio project.
NuGet
nuget install payload-api
Get Started
Once you've included the Payload C# library in your project,
include the Payload
namespace to get started.
All Payload objects and methods are accessible using the pl
static class.
API Authentication
To authenticate with the Payload API, you'll need a live or test API key. API keys are accessible from within the Payload dashboard.
using Payload;
pl.ApiKey = "secret_key_3bW9JMZtPVDOfFNzwRdfE";
Creating an Object
Interfacing with the Payload API is done primarily through Payload Objects. Below is an example of
creating a customer using the pl.Customer
object.
// Create a Customer
var customer = await pl.Customer.CreateAsync(new
{
email = "matt.perez@example.com",
name = "Matt Perez"
});
// Create a Payment
var payment = await pl.Payment.CreateAsync(new
{
amount = 100.0,
payment_method = new pl.Card(new
{
card_number = "4242 4242 4242 4242"
})
});
Accessing Object Attributes
Object attributes are accessible through both dot and bracket notation.
// Dynamic
Console.WriteLine(customer.name);
// Compile-time checking
Console.WriteLine(customer["email"]);
Console.WriteLine(customer.Data.email);
Updating an Object
Updating an object is a simple call to the UpdateAsync
object method.
// Updating a customer's email
await customer.UpdateAsync(new { email = "matt.perez@newwork.com" });
Selecting Objects
Objects can be selected using any of their attributes.
// Select a customer by email
var customers = await pl.Customer
.FilterBy(new { email = "matt.perez@example.com" })
.OneAsync();
Use the pl.Attr
attribute helper interface to write powerful
queries with a little extra syntax sugar.
var payments = await pl.Payment
.FilterBy(
pl.Attr.amount.gt(100),
pl.Attr.amount.lt(200),
pl.Attr.description.contains("Test"),
pl.Attr.created_at.gt(new DateTime(2019,2,1))
)
.AllAsync();
Testing the Payload C# Library
Tests are contained within the PayloadTests/ directory. To run tests enter the command in terminal
API_KEY=your_test_secret_key dotnet test
Documentation
To get further information on Payload's C# library and API capabilities, visit the unabridged Payload Documentation.
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.2)
- System.Net.Http (>= 4.3.4)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.2)
- System.Net.Http (>= 4.3.4)
- System.ValueTuple (>= 4.5.0)
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 |
---|---|---|
2.0.3 | 448 | 5/17/2024 |
2.0.2 | 110 | 5/9/2024 |
2.0.1 | 113 | 4/11/2024 |
2.0.0 | 129 | 1/19/2024 |
1.0.4 | 574 | 10/12/2023 |
1.0.3 | 152 | 8/22/2023 |
1.0.2 | 151 | 8/12/2023 |
1.0.1 | 168 | 7/25/2023 |
1.0.0 | 163 | 7/5/2023 |
0.3.0 | 248 | 4/27/2023 |
0.2.5 | 795 | 6/3/2021 |
0.2.4 | 380 | 3/18/2021 |
0.2.3 | 333 | 3/17/2021 |
0.2.2 | 515 | 12/3/2020 |
0.2.1 | 441 | 9/7/2020 |
0.2.0 | 438 | 8/26/2020 |
0.1.12 | 675 | 2/27/2020 |
0.1.10 | 530 | 1/13/2020 |
0.1.9 | 877 | 12/17/2019 |
0.1.8 | 524 | 12/4/2019 |
0.1.7 | 486 | 12/4/2019 |
0.1.6 | 567 | 6/19/2019 |
0.1.5 | 530 | 6/19/2019 |
0.1.4 | 535 | 6/16/2019 |
0.1.3 | 534 | 6/16/2019 |