Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bvdcode/CryptoPay.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

17 Commits

Repository files navigation

GitHub Nuget Static Badge GitHub Actions Workflow Status NuGet version (CryptoPay.NET) CodeFactor GitHub repo size

CryptoPay.NET

.NET Standard cryptocurrency payment library for Telegram bot @cryptobot.

Note: This repository was cloned because the original author irresponsibly corrupted his code.

Usage

  1. Install the NuGet package:
dotnet add package CryptoPay.NET
  1. Create a new instance of the CryptoPayClient class:
const string apiKey = "your-api-key";
var client = new CryptoPayClient(apiKey);
// or with custom base URL
var client = new CryptoPayClient(apiKey, apiUrl: "https://testnet-pay.crypt.bot/");
  1. Create an invoice
var invoice = await client.CreateInvoiceAsync(
 Assets.BNB,
 1.1,
 description: "test",
 paid_btn_name: PaidButtonNames.viewItem,
 paid_btn_url: "https://example.com/success",
 cancellationToken: cancellationToken);
  1. Get an invoice and handle the payment
while (true)
{
 var invoices = await client.GetInvoicesAsync(invoiceIds: new[] { invoice.Id });
 var invoice = invoices.Items.FirstOrDefault();
 if (invoice == null)
 {
 continue;
 }
 if (invoice.Status == CryptoPay.Types.Statuses.paid)
 {
 // Invoice is paid
 HandlePaidInvoice(invoice);
 break;
 }
 await Task.Delay(1000);
}
void HandlePaidInvoice(Invoice invoice)
{
 // Handle paid invoice
}

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Cryptocurrency payment library based for Telegram bot @cryptobot

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /