Skip to content

makecryptoio/makepay-dotnet-sdk

Repository files navigation

MakePay .NET SDK

Official .NET SDK for MakePay server-side integrations.

Use it to create payment links, send checkout emails, manage customers and subscriptions, build hosted checkout URLs, work with MakePay bookkeeping, and verify signed webhooks.

Installation

The package is planned for NuGet as:

dotnet add package MakePay

Until the first NuGet release, reference the project or package generated from this repository.

Quick Start

using MakePay;

var httpClient = new HttpClient();
var makePay = new MakePayClient(
    httpClient,
    new MakePayClientOptions
    {
        KeyId = Environment.GetEnvironmentVariable("MAKEPAY_KEY_ID")!,
        KeySecret = Environment.GetEnvironmentVariable("MAKEPAY_KEY_SECRET")!
    });

using var created = await makePay.CreatePaymentLinkAsync(
    new MakePayPaymentLinkPayload
    {
        Title = "Order #1042",
        Description = "Hosted checkout for order #1042",
        Amount = "129.99",
        Currency = "USDT",
        OrderId = "order_1042",
        CustomerEmail = "buyer@example.com",
        ReturnUrl = "https://merchant.example/orders/1042",
        SuccessUrl = "https://merchant.example/orders/1042/success",
        FailureUrl = "https://merchant.example/orders/1042/pay"
    });

Console.WriteLine(created.RootElement.GetProperty("paymentLink").GetProperty("publicUrl"));

Webhook Verification

Read the exact raw body before parsing JSON.

using var memory = new MemoryStream();
await Request.Body.CopyToAsync(memory);
var rawBody = memory.ToArray();
var signature = Request.Headers["X-MakePay-Signature"].ToString();

var isTrusted = MakePayWebhookVerifier.Verify(
    rawBody,
    signature,
    Environment.GetEnvironmentVariable("MAKEPAY_WEBHOOK_SECRET")!);

if (!isTrusted)
{
    return Results.Unauthorized();
}

Checkout URLs

var hosted = makePay.BuildHostedCheckoutUrl("01jsg7w9n8pz8l4x0dn26v2aqd");
var embedded = makePay.BuildEmbeddedCheckoutUrl(
    "01jsg7w9n8pz8l4x0dn26v2aqd",
    "https://merchant.example");

Validation

dotnet test
dotnet pack src/MakePay/MakePay.csproj -c Release --no-build

Maintainer: Ethan Carter (makepayio).

About

Official .NET SDK for MakePay payment links, checkout helpers, bookkeeping, and webhooks. Cryptocurrency payment gateway for direct self-custody merchant-wallet settlement, decentralized swaps, and 70+ coin/20+ chain auto-conversion.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages