Coinbase.Commerce.Packaging
1.0.2
dotnet add package Coinbase.Commerce.Packaging --version 1.0.2
NuGet\Install-Package Coinbase.Commerce.Packaging -Version 1.0.2
<PackageReference Include="Coinbase.Commerce.Packaging" Version="1.0.2" />
paket add Coinbase.Commerce.Packaging --version 1.0.2
#r "nuget: Coinbase.Commerce.Packaging, 1.0.2"
// Install Coinbase.Commerce.Packaging as a Cake Addin #addin nuget:?package=Coinbase.Commerce.Packaging&version=1.0.2 // Install Coinbase.Commerce.Packaging as a Cake Tool #tool nuget:?package=Coinbase.Commerce.Packaging&version=1.0.2
CoinbaseCommerce.NET
Project Description
The Coinbase Commerce API is a payment gateway that allows businesses to accept cryptocurrency payments from customers. This project provides Refit interfaces that can be used to communicate with the Coinbase Commerce API.
Installation
To use this in your own project you must:
- Get your own API key at Coinbase Commerce by registering a new user and go to the settings section.
- Paste the API key in the appsettings json file.
- Register all clients. Look at the program.cs file in the test API project for an example of how to do that.
Usage
Refit
NuGet is used for all clients. Once installed, you can create an instance of the ICoinbaseCommerceChargeClient
interface and use its methods to communicate with the Coinbase Commerce API.
Here's an example of how you can use the ICoinbaseCommerceChargeClient
interface to create a new charge:
var client = RestService.For<ICoinbaseCommerceChargeClient>("https://api.commerce.coinbase.com");
var request = new CoinbaseCommerceChargeRequest(
name: "My Product",
description: "A description of my product",
pricingType: PricingType.FixedPrice,
localPrice: new LocalPrice(
amount: "10.00",
currency: "USD"
),
metadata: new MetaData(
new Dictionary<string, string> {
{ "order_id", "123" }
}
),
redirectUrl: "https://example.com/redirect",
cancelUrl: "https://example.com/cancel",
requestedInfo: new List<string>()
);
var response = await client.CreateChargeAsync(request);
if (response.IsSuccessStatusCode)
{
var charge = response.Content.Data;
Console.WriteLine($"Charge created with ID: {charge.Id}");
}
else
{
Console.WriteLine($"Error creating charge: {response.Error}");
}
The other clients are quite similar but the request should always be adapted to the client you plan on using.
Contributing
Contributions are highly appreciated!
License
MIT license
Acknowledgements
Refit deserved a mention I suppose!
Support
Links
Commerce API Docs (Welcome | Coinbase Cloud)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Coinbase.Commerce.Clients (>= 1.0.1)
- Coinbase.Commerce.Models (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.