Skip to content

makecryptoio/makepay-aspnetcore-starter

Repository files navigation

MakePay ASP.NET Core Starter

Production-minded ASP.NET Core starter for MakePay payment links, hosted checkout redirects, signed webhooks, and bookkeeping invoice payment flows.

This repo is designed for SaaS dashboards, internal billing tools, merchant portals, and partner apps that need a server-side MakePay integration without exposing API secrets to the browser.

Features

  • Minimal API endpoints for creating and fetching payment links
  • Hosted checkout redirect route for a payment UID
  • Signed webhook endpoint with raw-body HMAC verification
  • Bookkeeping summary and invoice payment-link examples
  • Typed MakePay options through appsettings, environment variables, or secret stores
  • Unit tests for partner headers, payload shape, checkout URL building, and webhook verification
  • GitHub Actions validation for restore, build, test, and publish

Quick Start

Set secrets with environment variables:

export MakePay__KeyId="mk_live_or_test_key_id"
export MakePay__KeySecret="mk_live_or_test_key_secret"
export MakePay__WebhookSecret="whsec_live_or_test_secret"

Run the app:

dotnet run --project src/MakePay.AspNetCore.Starter

Create a payment link:

curl -X POST http://localhost:5088/api/payment-links \
  -H "Content-Type: application/json" \
  -d '{
    "sendPaymentRequestEmail": false,
    "payload": {
      "title": "Order #1042",
      "amount": "129.99",
      "currency": "USDT",
      "customerEmail": "buyer@example.com",
      "successUrl": "https://merchant.example/orders/1042/success",
      "failureUrl": "https://merchant.example/orders/1042/pay"
    }
  }'

Redirect a buyer to hosted checkout:

curl -i http://localhost:5088/api/checkout/pay_123

Configuration

The starter reads the MakePay configuration section:

{
  "MakePay": {
    "BaseUrl": "https://www.makecrypto.io",
    "CheckoutBaseUrl": "https://makepay.io",
    "KeyId": "",
    "KeySecret": "",
    "WebhookSecret": ""
  }
}

For hosted environments, prefer environment variables or a managed secret store:

MakePay__KeyId=mk_live_or_test_key_id
MakePay__KeySecret=mk_live_or_test_key_secret
MakePay__WebhookSecret=whsec_live_or_test_secret

Endpoints

Method Path Purpose
GET /health Health check
POST /api/payment-links Create a MakePay payment link
GET /api/payment-links/{uid} Fetch a MakePay payment link
GET /api/checkout/{uid} Redirect to hosted checkout
GET /api/bookkeeping/summary Read MakePay bookkeeping summary
POST /api/bookkeeping/invoices Create a bookkeeping invoice
POST /api/bookkeeping/invoices/{invoiceId}/payment-link Create a payment link for an invoice
POST /api/webhooks/makepay Verify and acknowledge MakePay webhooks

Webhooks

MakePay webhooks should be verified against the exact raw request body before parsing JSON. This starter accepts X-MakePay-Signature or MakePay-Signature headers using the t=<timestamp>,v1=<hex> signature format.

var signature = Request.Headers["X-MakePay-Signature"].ToString();
var trusted = MakePayWebhookVerifier.Verify(rawBody, signature, webhookSecret);

Validation

dotnet restore tests/MakePay.AspNetCore.Starter.Tests
dotnet build tests/MakePay.AspNetCore.Starter.Tests --configuration Release --no-restore
dotnet test tests/MakePay.AspNetCore.Starter.Tests --configuration Release --no-build
dotnet publish src/MakePay.AspNetCore.Starter --configuration Release --no-build --output artifacts/app

Relationship to the .NET SDK

The starter includes a small MakePay client so the repo can build and run before the official NuGet package is published. Once MakePay is available on NuGet, the planned migration is to replace the local client with the SDK package while preserving the same API routes and examples.

Maintainer: Ethan Carter (makepayio).

About

ASP.NET Core starter for MakePay payment links, checkout redirects, bookkeeping, and signed 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