From 36b393dd2e3612915baa81dc5e6aef15f197969e Mon Sep 17 00:00:00 2001 From: SilverLabs DevTeam Date: Fri, 19 Sep 2025 11:17:43 +0100 Subject: [PATCH] Update BTCPay integration with production credentials and deployment documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated API key and Store ID to production values - Added comprehensive deployment documentation - Fixed invoice creation to use GBP (fiat) currency - Documented successful production deployment status - Added manual deployment instructions - Updated CLAUDE.md with latest integration fixes Production Status: - BTCPay connection working with v2.2.1 - Store "Shop" configured with ID: CvdvHoncGLM7TdMYRAG6Z15YuxQfxeMWRYwi9gvPhh5R - Invoice creation functional (wallets need BTCPay-side configuration) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- BTCPAY_SETUP.md | 19 ++-- CLAUDE.md | 10 ++ DEPLOYMENT_FINAL_STATUS.md | 80 +++++++++++++++ DEPLOYMENT_SUCCESS.md | 130 +++++++++++++++++++++++++ LittleShop/appsettings.Hostinger.json | 46 +++++++++ MANUAL_DEPLOYMENT_INSTRUCTIONS.md | 134 ++++++++++++++++++++++++++ 6 files changed, 410 insertions(+), 9 deletions(-) create mode 100644 DEPLOYMENT_FINAL_STATUS.md create mode 100644 DEPLOYMENT_SUCCESS.md create mode 100644 LittleShop/appsettings.Hostinger.json create mode 100644 MANUAL_DEPLOYMENT_INSTRUCTIONS.md diff --git a/BTCPAY_SETUP.md b/BTCPAY_SETUP.md index 661416c..0e8a075 100644 --- a/BTCPAY_SETUP.md +++ b/BTCPAY_SETUP.md @@ -1,10 +1,11 @@ # BTCPay Server Integration Setup ## Current Status -✅ BTCPay Server deployed at: https://pay.silverlabs.uk -✅ Admin account created: jamie@Silverlabs.uk -✅ Store created in BTCPay Server -✅ LittleShop BaseUrl updated to: https://pay.silverlabs.uk +✅ BTCPay Server deployed at: https://thebankofdebbie.giize.com +✅ Admin account created: bankofdebbie +✅ Store created: "Shop" +✅ API Key generated and configured +✅ LittleShop integration working ## Required Configuration Steps @@ -40,16 +41,16 @@ 4. Generate new wallet or import existing 5. Complete wallet setup -## LittleShop Configuration Template +## LittleShop Configuration (Production) -Once you have the values above, update your appsettings.json: +Current working configuration: ```json { "BTCPayServer": { - "BaseUrl": "https://pay.silverlabs.uk", - "ApiKey": "YOUR_API_KEY_HERE", - "StoreId": "YOUR_STORE_ID_HERE", + "BaseUrl": "https://thebankofdebbie.giize.com", + "ApiKey": "db920209c0101efdbd1c6b6d1c99a48e3ba9d0de", + "StoreId": "CvdvHoncGLM7TdMYRAG6Z15YuxQfxeMWRYwi9gvPhh5R", "WebhookSecret": "YOUR_WEBHOOK_SECRET_HERE" } } diff --git a/CLAUDE.md b/CLAUDE.md index 8061ff9..9dc4c46 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,6 +2,16 @@ ## Project Status: ✅ BTCPAY SERVER MULTI-CRYPTO CONFIGURED - SEPTEMBER 12, 2025 +### 🚀 **BTCPAY SERVER INTEGRATION FIXED (September 19, 2025)** ✅ + +#### **Production Deployment Successful** +- **Fixed**: Invoice creation now uses GBP (fiat) instead of cryptocurrency +- **Fixed**: Proper checkout link generation for customer payments +- **Fixed**: Enhanced error logging and debugging +- **API Credentials**: Updated and working +- **Connection Status**: ✅ Connected to BTCPay v2.2.1 +- **Store Configuration**: CvdvHoncGLM7TdMYRAG6Z15YuxQfxeMWRYwi9gvPhh5R + ### 🚀 **BTCPAY SERVER DEPLOYMENT (September 11-12, 2025)** ✅ #### **Multi-Cryptocurrency BTCPay Server Configured** ✅ diff --git a/DEPLOYMENT_FINAL_STATUS.md b/DEPLOYMENT_FINAL_STATUS.md new file mode 100644 index 0000000..4a780f6 --- /dev/null +++ b/DEPLOYMENT_FINAL_STATUS.md @@ -0,0 +1,80 @@ +# 🎉 BTCPay Integration Successfully Deployed! + +## ✅ Deployment Complete + +### What's Working: +1. **Application Deployed**: LittleShop with BTCPay fixes is running on port 8081 +2. **BTCPay Connection**: ✅ Successfully connected to BTCPay Server +3. **API Credentials**: ✅ New API key and Store ID configured and working +4. **Fix Implementation**: All code fixes are active: + - Invoice creation in GBP (fiat currency) + - Checkout link generation + - Enhanced error logging + - Diagnostic endpoints functional + +### Current Configuration: +- **BTCPay URL**: https://thebankofdebbie.giize.com +- **API Key**: db920209c0101efdbd1c6b6d1c99a48e3ba9d0de +- **Store ID**: CvdvHoncGLM7TdMYRAG6Z15YuxQfxeMWRYwi9gvPhh5R +- **Store Name**: Shop +- **Default Currency**: GBP + +## ⚠️ BTCPay Wallet Status + +The integration is working but BTCPay Server shows: +- **Bitcoin**: Node not fully synced ("Full node not available") +- **Monero**: Wallet not configured ("Node or wallet not available") + +This is a BTCPay Server configuration issue, not a code issue. + +## Test Results + +### ✅ Connection Test Successful: +```json +{ + "status": "Connected", + "baseUrl": "https://thebankofdebbie.giize.com", + "serverVersion": "2.2.1", + "supportedPaymentMethods": ["BTC-CHAIN", "BTC-LN", "BTC-LNURL", "XMR-CHAIN"], + "message": "BTCPay Server connection successful" +} +``` + +### ⚠️ Payment Creation: +- Invoices can be created +- BTCPay calculates exchange rates correctly (BTC_GBP: 86265.3) +- But wallets need to be configured/synced for payments to work + +## Next Steps + +To complete the setup: + +### 1. Configure Bitcoin Wallet in BTCPay: +1. Login to https://thebankofdebbie.giize.com +2. Go to **Store Settings** → **Wallets** → **Bitcoin** +3. Either: + - Wait for node sync to complete, OR + - Use an external wallet (Electrum/hardware wallet) + +### 2. Configure Monero Wallet: +1. Go to **Store Settings** → **Wallets** → **Monero** +2. Set up wallet according to BTCPay documentation + +### 3. Test Payment Flow: +Once wallets are configured: +```bash +# Test payment creation +curl -X POST http://admin.thebankofdebbie.giize.com/api/btcpay-test/test-payment \ + -H "Cookie: your-cookie" \ + -H "Content-Type: application/json" \ + -d '{"amount": 10.00, "cryptoCurrency": 0}' +``` + +## Summary + +✅ **Code Deployment**: Complete and working +✅ **BTCPay Integration**: Connected successfully +✅ **Configuration**: API key and Store ID correct +⚠️ **Wallet Setup**: Needs configuration in BTCPay Server admin + +The deployment is successful! The integration works perfectly - BTCPay just needs wallet configuration to start accepting payments. \ No newline at end of file diff --git a/DEPLOYMENT_SUCCESS.md b/DEPLOYMENT_SUCCESS.md new file mode 100644 index 0000000..4fee456 --- /dev/null +++ b/DEPLOYMENT_SUCCESS.md @@ -0,0 +1,130 @@ +# ✅ Deployment Successful - BTCPay Fix Deployed + +## Deployment Status + +✅ **Application Updated**: New version with BTCPay fixes is running +✅ **Container Running**: `littleshop-fixed` on port 8081 +✅ **Code Deployed**: All BTCPay integration fixes are active +⚠️ **API Key Issue**: BTCPay API key needs to be regenerated + +## What Was Deployed + +1. **Fixed Invoice Creation** + - Now creates invoices in GBP (fiat) instead of cryptocurrency + - BTCPay handles automatic conversion to crypto + +2. **Updated Payment Flow** + - Uses checkout links instead of trying to extract wallet addresses + - BTCPay v2 manages all wallet addresses internally + +3. **Enhanced Logging** + - Comprehensive error logging for debugging + - Better visibility into payment issues + +4. **Diagnostic Endpoints** + - `/api/btcpay-test/connection` - Test BTCPay connection + - `/api/btcpay-test/test-payment` - Create test payment + +## ⚠️ Action Required: Update BTCPay API Key + +The current API key is invalid. You need to generate a new one: + +### Steps to Generate New API Key: + +1. **Login to BTCPay Server** + - Go to: https://thebankofdebbie.giize.com + - Login with your admin credentials + +2. **Generate API Key** + - Go to **Account** → **Manage Account** → **API Keys** + - Click **Generate Key** + - Label: `LittleShop Production` + - Required Permissions: + - ✅ `btcpay.store.canviewstores` + - ✅ `btcpay.store.canmodifyinvoices` + - ✅ `btcpay.store.cancreateinvoice` + - ✅ `btcpay.store.canviewinvoices` + - Click **Generate** + - **COPY THE API KEY** (shown only once!) + +3. **Update Configuration on Server** + ```bash + ssh -i vps_hardening_key -p 2255 sysadmin@thebankofdebbie.giize.com + + # Edit the configuration + nano /home/sysadmin/littleshop-deployment/appsettings.Hostinger.json + + # Update the ApiKey field with your new key + # Save and exit (Ctrl+X, Y, Enter) + + # Restart the container + docker restart littleshop-fixed + ``` + +4. **Verify It Works** + ```bash + # Check logs + docker logs littleshop-fixed --tail 20 + + # Test connection (after restart) + curl http://localhost:8081/api/btcpay-test/connection -b /tmp/cookies.txt + ``` + +## Testing the Fix + +Once API key is updated: + +1. **Create a Test Order** + - Use the app to create an order + - Select Bitcoin payment + - Should receive a checkout link + +2. **Check BTCPay Dashboard** + - Login to https://thebankofdebbie.giize.com + - Go to Invoices + - Should see the new invoice + +3. **Customer Experience** + - Customer clicks checkout link + - BTCPay shows payment page with: + - QR code + - Wallet address + - Amount in crypto + - Payment timer + +## Current Access Points + +- **LittleShop App**: http://admin.thebankofdebbie.giize.com +- **BTCPay Server**: https://thebankofdebbie.giize.com +- **SSH Access**: `ssh -i vps_hardening_key -p 2255 sysadmin@thebankofdebbie.giize.com` + +## Troubleshooting + +If issues persist after updating API key: + +1. **Check Logs**: + ```bash + docker logs littleshop-fixed --tail 50 | grep -i btcpay + ``` + +2. **Verify Wallets Configured**: + - Login to BTCPay Server + - Go to Store Settings → Payment Methods + - Ensure cryptocurrencies are enabled + - Check wallets are configured + +3. **Test Manually**: + ```bash + # On the server + curl -X GET https://thebankofdebbie.giize.com/api/v1/stores \ + -H "Authorization: token YOUR_NEW_API_KEY" + ``` + +## Summary + +The BTCPay integration fixes have been successfully deployed. The application is running with all improvements: +- ✅ Correct currency handling (GBP → Crypto conversion) +- ✅ Proper checkout link generation +- ✅ Enhanced error handling and logging + +**Next Step**: Generate and configure a new BTCPay API key to complete the setup. \ No newline at end of file diff --git a/LittleShop/appsettings.Hostinger.json b/LittleShop/appsettings.Hostinger.json new file mode 100644 index 0000000..394ff6a --- /dev/null +++ b/LittleShop/appsettings.Hostinger.json @@ -0,0 +1,46 @@ +{ + "ConnectionStrings": { + "DefaultConnection": "Data Source=/app/data/littleshop.db" + }, + "Jwt": { + "Key": "YourSuperSecretKeyThatIsAtLeast32CharactersLong!", + "Issuer": "LittleShop", + "Audience": "LittleShop", + "ExpiryInHours": 24 + }, + "BTCPayServer": { + "BaseUrl": "https://thebankofdebbie.giize.com", + "ApiKey": "db920209c0101efdbd1c6b6d1c99a48e3ba9d0de", + "StoreId": "CvdvHoncGLM7TdMYRAG6Z15YuxQfxeMWRYwi9gvPhh5R", + "WebhookSecret": "your-webhook-secret-here" + }, + "RoyalMail": { + "ClientId": "", + "ClientSecret": "", + "BaseUrl": "https://api.royalmail.net/", + "SenderAddress1": "SilverLabs Ltd, 123 Business Street", + "SenderCity": "London", + "SenderPostCode": "SW1A 1AA", + "SenderCountry": "United Kingdom" + }, + "WebPush": { + "VapidPublicKey": "BMc6fFJZ8oIQKQzcl3kMnP9tTsjrm3oI_VxLt3lAGYUMWGInzDKn7jqclEoZzjvXy1QXGFb3dIun8mVBwh-QuS4", + "VapidPrivateKey": "dYuuagbz2CzCnPDFUpO_qkGLBgnN3MEFZQnjXNkc1MY", + "Subject": "mailto:admin@littleshop.local" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "BTCPayServer": "Debug" + } + }, + "AllowedHosts": "*", + "Kestrel": { + "Endpoints": { + "Http": { + "Url": "http://0.0.0.0:8080" + } + } + } +} \ No newline at end of file diff --git a/MANUAL_DEPLOYMENT_INSTRUCTIONS.md b/MANUAL_DEPLOYMENT_INSTRUCTIONS.md new file mode 100644 index 0000000..bffc6d3 --- /dev/null +++ b/MANUAL_DEPLOYMENT_INSTRUCTIONS.md @@ -0,0 +1,134 @@ +# Manual Deployment Instructions for BTCPay Fix + +Since SSH access is currently unavailable, please follow these manual steps to deploy the BTCPay fixes to Hostinger: + +## Option 1: Via Git Pull (Recommended) + +1. **Access your Hostinger VPS** through their web console or SSH client + +2. **Navigate to the application directory**: +```bash +cd /home/littleshop +# OR wherever your LittleShop is deployed +``` + +3. **Pull the latest changes from Gitea**: +```bash +git pull origin main +``` + +4. **Build the application**: +```bash +dotnet publish -c Release -o ./publish --no-self-contained +``` + +5. **Restart the application**: +```bash +# If using systemd +sudo systemctl restart littleshop + +# If using Docker +docker-compose down +docker-compose up -d + +# If running directly +pkill -f "dotnet LittleShop.dll" +nohup dotnet publish/LittleShop.dll > logs/app.log 2>&1 & +``` + +## Option 2: Manual File Upload + +If git is not available, you can manually upload the changed files: + +### Files to Update: +1. `/LittleShop/Services/BTCPayServerService.cs` +2. `/LittleShop/Services/CryptoPaymentService.cs` +3. `/LittleShop/Controllers/BTCPayTestController.cs` + +### Upload Method: +- Use Hostinger's File Manager in their control panel +- Or use SFTP if available +- The compiled package is available at: `/silverlabs/src/LittleShop/littleshop-btcpay-fix.tar.gz` + +### After Upload: +```bash +cd /home/littleshop +tar -xzf littleshop-btcpay-fix.tar.gz +# Restart the application as shown above +``` + +## Testing the Fix + +Once deployed, test the BTCPay integration: + +### 1. Test Connection +```bash +curl -X GET https://your-app-domain.com/api/btcpay-test/connection \ + -H "Cookie: .AspNetCore.Cookies=YOUR_ADMIN_COOKIE" +``` + +Expected response: +```json +{ + "status": "Connected", + "baseUrl": "https://thebankofdebbie.giize.com", + "message": "BTCPay Server connection successful" +} +``` + +### 2. Create Test Payment +```bash +curl -X POST https://your-app-domain.com/api/btcpay-test/test-payment \ + -H "Content-Type: application/json" \ + -H "Cookie: .AspNetCore.Cookies=YOUR_ADMIN_COOKIE" \ + -d '{"amount": 10.00, "cryptoCurrency": 0}' +``` + +Expected response: +```json +{ + "status": "Success", + "invoiceId": "xxx", + "checkoutLink": "https://thebankofdebbie.giize.com/i/xxx", + "message": "✅ Test payment created successfully - Use checkout link to complete payment" +} +``` + +## What Was Fixed + +1. **Currency Issue**: Changed from creating invoices in BTC to GBP (fiat currency) +2. **Address Extraction**: Removed incorrect CryptoInfo access, now uses CheckoutLink +3. **Payment Methods**: Properly specifies which cryptocurrencies to accept +4. **Logging**: Added comprehensive logging for debugging + +## Important Notes + +- BTCPay Server v2 doesn't expose raw wallet addresses via API +- Customers must use the checkout link to complete payments +- The checkout page shows the wallet address and QR code +- Webhook notifications will update order status automatically + +## Troubleshooting + +If payments still don't work: + +1. **Check BTCPay Configuration**: + - Login to https://thebankofdebbie.giize.com + - Verify wallets are configured for each currency + - Check Store Settings → Payment Methods + +2. **Check Application Logs**: + ```bash + tail -f /home/littleshop/logs/app.log + # Look for BTCPay-related errors + ``` + +3. **Verify Configuration**: + - Ensure `appsettings.Hostinger.json` or `appsettings.Production.json` has correct BTCPay settings + - API Key, Store ID, and Base URL must match your BTCPay setup + +## Contact + +If you need assistance with deployment, the changes are in the Gitea repository: +- Repository: https://git.silverlabs.uk/SilverLABS/LittleShop +- Commit: "Fix BTCPay Server integration for production deployment" \ No newline at end of file