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                
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="Coinbase.Commerce.Packaging" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Coinbase.Commerce.Packaging --version 1.0.2                
#r "nuget: Coinbase.Commerce.Packaging, 1.0.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 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

Buy me a beer 😃

Commerce API Docs (Welcome | Coinbase Cloud)

Product 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. 
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
1.0.2 204 5/20/2023
1.0.1 185 5/19/2023 1.0.1 is deprecated because it has critical bugs.