CryptoPay
Cryptocurrency payment system based on @cryptobot in Telegram
Install / Use
/learn @WinoGarcia/CryptoPayREADME
.NET Client for CryptoPay by @CryptoBot
Crypto Pay is a payment system based on @CryptoBot, which allows you to accept payments in cryptocurrency using the API.
This .NET library help you to work with Crypto Pay via Crypto Pay API.
Install
Use the nuget package.
Usage
API
First, you need to create your application and get an API token. Open @CryptoBot or @CryptoTestnetBot (for testnet), send a command /pay to create a new app and get API Token.
Don't forget to configure the ApiUrl and your CryptoPayApiToken:
builder.Services.AddHttpClient<ICryptoPayClient, CryptoPayClient>(client =>
{
client.BaseAddress = new Uri("https://pay.crypt.bot/");
client.DefaultRequestHeaders.Add("Crypto-Pay-API-Token", "token");
});
Next step: try to call a simple GetMeAsync(...) method to check that everything is working well:
var application = await cryptoPayClient.GetMeAsync(cancellationToken);
Net | Bot | Hostname
------- |--------------------------------------------------------------|------------------------
mainnet | @CryptoBot | https://pay.crypt.bot/
testnet | @CryptoTestnetBot | https://testnet-pay.crypt.bot/
All queries to the Crypto Pay API must be sent over HTTPS
You can find all available methods in the documentation.
Also, you can create invoice with supported assets and paid button names:
var invoice = await cryptoPayClient.CreateInvoiceAsync(
Assets.BNB,
1.505,
description: "kitten",
paid_btn_name: PaidButtonNames.viewItem,
paid_btn_url: "https://placekitten.com/150",
cancellationToken: cancellationToken);
Webhooks
Use Webhooks to get updates for the app.
If you'd like to make sure that the Webhook request comes from Crypto Pay, we recommend using a secret path in the URL, e.g. https://www.example.com/<secret>.
Webhooks will send may at least one time
Example endpoint. You should use CryptoPayHelper.CheckSignature(...) to check signature from crypto-pay-api-signature
[HttpPost]
public async Task<IActionResult> PostAsync(CancellationToken cancellationToken = default)
{
var updateBodyBytes = new byte[this.HttpContext.Request.ContentLength!.Value];
await this.HttpContext.Request.Body.ReadExactlyAsync(updateBodyBytes, cancellationToken);
var update = JsonSerializer.Deserialize<Update>(updateBodyBytes, new JsonSerializerOptions()
{
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString
});
if (update is not null &&
update.UpdateType == UpdateTypes.invoice_paid &&
this.HttpContext.Request.Headers.TryGetValue("crypto-pay-api-signature", out var signature) &&
CryptoPayHelper.CheckSignature(signature, cryptoPayApiToken, updateBodyBytes))
{
// Here your processing of successful payment
return this.Ok();
}
return this.BadRequest();
}
Explore all available methods from the documentation.
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
