Donor Box - Quick Setup, Instant Donations
View DemoEfficient, scalable, and ready to integrate into your application!
Donation Box: Empowering Contributions Made Simple
The Donation Box is a flexible, easy-to-integrate solution designed to simplify the process of accepting donations online. Built with modern technologies like jQuery, .NET Core, and MS SQL, it ensures seamless functionality and a user-friendly experience.
With support for customizable donation packages, secure payment processing through PayPal and credit cards, and effortless integration into any website platform, Donation Box provides everything you need to maximize contributions and support your cause.
Who Is This For?
This Donation Box is crafted to cater to a wide range of users. Whether you're a developer, a nonprofit organization, or an individual raising funds, this tool is the perfect solution to simplify the donation process and enhance your fundraising efforts.
For Developers:
Developers will appreciate the robust and modular design of the Donation Box, making it easy to integrate into existing projects. It offers quick customization options, seamless PayPal and card payment integration, and detailed documentation to ensure smooth implementation. Save development time while providing a feature-rich donation system to your clients or projects.
For Charities and Nonprofit Organizations:
Whether you're a small nonprofit or a global charity, the Donation Box is a powerful tool to streamline fundraising efforts. Set up predefined donation packages, accept secure payments, and provide donors with a hassle-free experience to maximize contributions and support your cause.
For Business and Community Fundraising:
Businesses or communities looking to raise funds for a cause, event, or initiative can leverage the Donation Box to make the process simple and effective. Its versatile features allow you to customize donation options and provide donors with a secure and intuitive platform.
Why Choose Our Donation Box?
The Donation Box goes beyond basic payment forms. It offers a comprehensive solution for modern fundraising with advanced features, top-tier security, and unmatched ease of integration. Whether you're a tech-savvy developer or a fundraising novice, Donation Box ensures your donations are collected efficiently and professionally.
Features
The Donation Box offers a rich set of features designed to make the donation process seamless, user-friendly, and highly efficient. Whether you're a developer or an organization, this solution is customizable to meet your specific needs while ensuring a hassle-free experience for your donors.
Key Features:
-
Multiple Package Selection:
Allow users to choose from predefined donation packages, making it easy for donors to contribute based on their preferences and budget. -
Custom Donation Amount:
Provide flexibility by allowing donors to input their own custom donation amount, ensuring inclusivity for all contributors. -
User Details Collection:
Capture essential donor information, including name, email, and phone number, for record-keeping and personalized communication. -
Automated Donation Receipts:
Send customized receipts to donors via email after successful transactions, providing them with proof of their contribution. -
Clear and Responsive Layout:
The Donation Box features a clean and intuitive design, ensuring an excellent user experience across all devices and platforms. -
Secure Payment Integration:
Support for PayPal and debit/credit card payments ensures secure and reliable transactions for both donors and organizations. -
Easy Integration:
Quickly integrate the Donation Box into any website or platform, regardless of the underlying technology, with minimal effort. -
Developer-Friendly:
The Donation Box comes with detailed documentation and customizable code, allowing developers to tailor the solution to fit specific requirements. -
Transaction Records:
Maintain detailed logs of all transactions, including donor details, payment status, and amounts, for auditing and reporting purposes. -
Cross-Platform Compatibility:
Designed to work seamlessly with various platforms, ensuring flexibility and reliability for diverse use cases.
Technology Stack
- Frontend: jQuery, AJAX, HTML, CSS
- Backend: .NET (ASP.NET Core), PHP, Node.js, Java (Spring Boot)
- Database: SQL-based database (MySQL, PostgreSQL, or MSSQL)
- Deployment: Compatible with IIS, Apache, Nginx, or cloud platforms like AWS, Azure, and Heroku.
Database Structure
MS SQL Server
MY SQL
PostgreSQL
MS SQL Server
The Donation system uses the following table:
Donation Table
CREATE TABLE Donation ( DonationId INT PRIMARY KEY IDENTITY(1,1), Email NVARCHAR(255), Phone NVARCHAR(50), DonationAmount DECIMAL(18,2), ChargesAmount DECIMAL(18,2) NULL, SelectionDate DATETIME NOT NULL, PaymentDate DATETIME NULL, PaymentMode NVARCHAR(50) NULL, IsPaid BIT NULL, PaymentReferenceID NVARCHAR(255) NULL, Remarks NVARCHAR(MAX) NULL );
MySQL
The Donation system uses the following table:
Donation Table
CREATE TABLE Donation ( DonationId INT PRIMARY KEY AUTO_INCREMENT, Email VARCHAR(255), Phone VARCHAR(50), DonationAmount DECIMAL(18,2), ChargesAmount DECIMAL(18,2) NULL, SelectionDate DATETIME NOT NULL, PaymentDate DATETIME NULL, PaymentMode VARCHAR(50) NULL, IsPaid TINYINT(1) NULL, PaymentReferenceID VARCHAR(255) NULL, Remarks TEXT NULL );
PostgreSQL
The Donation system uses the following table:
Donation Table
CREATE TABLE Donation ( DonationId SERIAL PRIMARY KEY, Email VARCHAR(255), Phone VARCHAR(50), DonationAmount NUMERIC(18,2), ChargesAmount NUMERIC(18,2) NULL, SelectionDate TIMESTAMP NOT NULL, PaymentDate TIMESTAMP NULL, PaymentMode VARCHAR(50) NULL, IsPaid BOOLEAN NULL, PaymentReferenceID VARCHAR(255) NULL, Remarks TEXT NULL );
Scripts and Libraries Used
- SweetAlert2: For stylish pop-up alerts and notifications.
- Strpe: For stripe js integration.
- Paypal: For paypal js integration.
Included Scripts:
- SweetAlert2:
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
- Stripe:
<included>
- Paypal:
<included>
Integration Steps
To integrate the Donation system with your application:
- Deploy the backend code for your preferred technology (.NET, PHP, Node.js, or Java).
- Update the database connection string in the respective backend code.
- Configure the AJAX endpoints in the front-end JavaScript to point to your server.
- Test the application with sample data to ensure functionality.
To generate a Google Cloud API key for Translation:
- Sign in to Google Cloud Console: Go to Google Cloud Console.
- Create a Project: Click on "Select a Project" and then "New Project" to create one.
- Enable the Translation API: Go to the Google Cloud Translation API page and click "Enable."
- Create Credentials: Navigate to the "Credentials" page and click "Create Credentials," then choose "API Key."
- Restrict the API Key (optional): You can restrict usage for security purposes.
- For more details, visit Google's API documentation.
To generate a PayPal API key:
- Sign in to PayPal Developer Dashboard: Go to PayPal Developer Dashboard.
- Create or Use an App: Navigate to "My Apps & Credentials" and click "Create App" or select an existing app.
- Configure App Details: Fill in the app details and click "Create App."
- Obtain Client ID and Secret: Once the app is created, you'll find the **Client ID** and **Secret** under the app details.
- Switch Between Environments: Use sandbox credentials for testing and live credentials for production.
- For more details, visit PayPal's API documentation.
To generate Stripe API keys:
- Sign in to Stripe Dashboard: Go to Stripe Dashboard.
- Navigate to API Keys: Click on "Developers" in the sidebar, then "API Keys."
- Obtain Publishable and Secret Keys: You'll find the **Publishable Key** and **Secret Key** listed. Use these keys for integration.
- Switch Between Environments: Use test keys for testing and live keys for production.
- Secure Your Keys: Never expose your secret keys in the front-end code. Store them securely in your server.
- For more details, visit Stripe's API documentation.
Server-Side Code
.NET
PHP
Node.js
Java
.NET (ASP.NET Core)
// POST: Create payment intent [HttpPost] public IActionResult CreatePaymentIntent(string email, string phone, decimal amount) { // Set your secret key StripeConfiguration.ApiKey = "yourstripekey"; // Replace with your Stripe Secret Key try { // Convert amount to cents long amountInCents = (long)(amount * 100); var options = new PaymentIntentCreateOptions { Amount = amountInCents, Currency = "usd", PaymentMethodTypes = new List{ "card", }, }; var service = new PaymentIntentService(); PaymentIntent intent = service.Create(options); // Store the initial record in the database var donation = new Donation { Email = email, Phone = phone, DonationAmount = amount, SelectionDate = DateTime.Now, PaymentDate = null, // Will update on successful payment PaymentMode = "Stripe", Ispaid = false, PaymentReferneceID = intent.Id, // Store the PaymentIntent ID for reference Remarks = "Pending Payment" }; _dbContext.Donations.Add(donation); _dbContext.SaveChanges(); return Json(new { clientSecret = intent.ClientSecret, success = true }); } catch (Exception ex) { return Json(new { success = false, message = ex.Message }); } } [HttpPost] public IActionResult UpdatePaymentStatus(string paymentReferenceID) { try { var donation = _dbContext.Donations.FirstOrDefault(d => d.PaymentReferneceID == paymentReferenceID); if (donation == null) return Json(new { success = false, message = "Donation record not found." }); donation.Ispaid = true; donation.PaymentDate = DateTime.Now; donation.Remarks = "Payment Successful"; _dbContext.SaveChanges(); return Json(new { success = true }); } catch (Exception ex) { return Json(new { success = false, message = ex.Message }); } } [HttpPost] public IActionResult PayPalPayment(string email, string phone, decimal amount, string payerId, string paymentId) { try { // Record the successful donation in the database var donation = new Donation { Email = email, Phone = phone, DonationAmount = amount, SelectionDate = DateTime.Now, PaymentDate = DateTime.Now, // Set the payment date to the current time PaymentMode = "PayPal", Ispaid = true, // Mark as paid PaymentReferneceID = paymentId, // Store the PayPal Payment ID for reference Remarks = "Payment Completed" }; // Save the donation record in the database _dbContext.Donations.Add(donation); _dbContext.SaveChanges(); return Json(new { success = true, message = "Donation recorded successfully." }); } catch (Exception ex) { return Json(new { success = false, message = ex.Message }); } }
PHP
// POST: Create payment intent $amountInCents, 'currency' => 'usd', 'payment_method_types' => ['card'], ]); // Store the initial record in the database (Use your DB connection here) $donation = [ 'Email' => $email, 'Phone' => $phone, 'DonationAmount' => $amount, 'SelectionDate' => date('Y-m-d H:i:s'), 'PaymentDate' => null, // Will update on successful payment 'PaymentMode' => 'Stripe', 'Ispaid' => false, 'PaymentReferneceID' => $paymentIntent->id, // Store the PaymentIntent ID for reference 'Remarks' => 'Pending Payment' ]; // Insert into the database (replace with your DB logic) // Example: $db->insert('donations', $donation); // Return the client secret to the frontend echo json_encode(['clientSecret' => $paymentIntent->client_secret, 'success' => true]); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); } } ?> // POST: Update payment status query("SELECT * FROM donations WHERE PaymentReferneceID = '$paymentReferenceID'"); if (!$donation) { echo json_encode(['success' => false, 'message' => 'Donation record not found.']); exit; } // Update donation status $donation['Ispaid'] = true; $donation['PaymentDate'] = date('Y-m-d H:i:s'); $donation['Remarks'] = 'Payment Successful'; // Save the updated donation record in the database (replace with your DB logic) // Example: $db->update('donations', $donation); echo json_encode(['success' => true]); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); } } ?> // POST: PayPal payment $email, 'Phone' => $phone, 'DonationAmount' => $amount, 'SelectionDate' => date('Y-m-d H:i:s'), 'PaymentDate' => date('Y-m-d H:i:s'), // Set the payment date to the current time 'PaymentMode' => 'PayPal', 'Ispaid' => true, // Mark as paid 'PaymentReferneceID' => $paymentId, // Store the PayPal Payment ID for reference 'Remarks' => 'Payment Completed' ]; // Save the donation record in the database (replace with your DB logic) // Example: $db->insert('donations', $donation); echo json_encode(['success' => true, 'message' => 'Donation recorded successfully.']); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); } } ?>
Node.js (Express + MySQL)
const express = require('express'); const stripe = require('stripe')('sk_test_51QV8zsC7t26NzuTMmWF310gRzMMfhhclYcfLuwKrYhNNwcBHdimsE74tu0gj94QONq3fmpZsnFfDAHbMTYVR7i3r00NvztIBoB'); // Replace with your Stripe Secret Key const bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.json()); // POST: Create payment intent app.post('/create-payment-intent', async (req, res) => { const { email, phone, amount } = req.body; try { // Convert amount to cents const amountInCents = Math.round(amount * 100); // Create a PaymentIntent const paymentIntent = await stripe.paymentIntents.create({ amount: amountInCents, currency: 'usd', payment_method_types: ['card'], }); // Store the initial record in the database (use your DB logic here) const donation = { email, phone, donationAmount: amount, selectionDate: new Date(), paymentDate: null, // Will update on successful payment paymentMode: 'Stripe', isPaid: false, paymentReferenceID: paymentIntent.id, // Store the PaymentIntent ID for reference remarks: 'Pending Payment' }; // Save donation record in your database here // Return client secret to the frontend res.json({ clientSecret: paymentIntent.client_secret, success: true }); } catch (error) { res.json({ success: false, message: error.message }); } }); // POST: Update payment status app.post('/update-payment-status', async (req, res) => { const { paymentReferenceID } = req.body; try { // Fetch the donation record by PaymentReferenceID (use your DB logic here) const donation = await db.getDonationByPaymentReferenceID(paymentReferenceID); // Replace with actual DB logic if (!donation) { return res.json({ success: false, message: 'Donation record not found.' }); } // Update donation status donation.isPaid = true; donation.paymentDate = new Date(); donation.remarks = 'Payment Successful'; // Save the updated donation record in the database (replace with your DB logic) await db.updateDonation(donation); // Replace with actual DB logic res.json({ success: true }); } catch (error) { res.json({ success: false, message: error.message }); } }); app.listen(3000, () => { console.log('Server is running on port 3000'); }); const express = require('express'); const paypal = require('paypal/checkout-server-sdk'); const bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.json()); // PayPal SDK environment setup const clientId = 'YOUR_PAYPAL_CLIENT_ID'; const clientSecret = 'YOUR_PAYPAL_CLIENT_SECRET'; const environment = new paypal.core.SandboxEnvironment(clientId, clientSecret); const client = new paypal.core.PayPalHttpClient(environment); // POST: PayPal payment app.post('/paypal-payment', async (req, res) => { const { email, phone, amount, payerId, paymentId } = req.body; try { // Record the successful donation in the database const donation = { email, phone, donationAmount: amount, selectionDate: new Date(), paymentDate: new Date(), // Set the payment date to the current time paymentMode: 'PayPal', isPaid: true, // Mark as paid paymentReferenceID: paymentId, // Store the PayPal Payment ID for reference remarks: 'Payment Completed' }; // Save the donation record in the database (replace with your DB logic) await db.saveDonation(donation); // Replace with actual DB logic res.json({ success: true, message: 'Donation recorded successfully.' }); } catch (error) { res.json({ success: false, message: error.message }); } }); app.listen(3000, () => { console.log('Server is running on port 3000'); });
Java (Spring Boot + MySQL)
import com.stripe.Stripe; import com.stripe.model.PaymentIntent; import com.stripe.exception.StripeException; import com.stripe.param.PaymentIntentCreateParams; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.List; Service public class StripeService { Value("${stripe.api.key}") private String stripeApiKey; public PaymentIntent createPaymentIntent(Long amount) throws StripeException { Stripe.apiKey = stripeApiKey; PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() .setAmount(amount * 100) // Convert to cents .setCurrency("usd") .addPaymentMethodType("card") .build(); return PaymentIntent.create(params); } } Entity public class Donation { Id GeneratedValue private Long id; private String email; private String phone; private Double donationAmount; private Date selectionDate; private Date paymentDate; private String paymentMode; private Boolean isPaid; private String paymentReferenceID; private String remarks; // Getters and setters } import org.springframework.data.jpa.repository.JpaRepository; public interface DonationRepository extends JpaRepository{ Donation findByPaymentReferenceID(String paymentReferenceID); } import com.stripe.exception.StripeException; import com.stripe.model.PaymentIntent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; RestController RequestMapping("/payment") public class PaymentController { Autowired private StripeService stripeService; Autowired private DonationRepository donationRepository; // Create Stripe Payment Intent PostMapping("/create-payment-intent") public String createPaymentIntent(RequestParam String email, RequestParam String phone, RequestParam Double amount) { try { PaymentIntent paymentIntent = stripeService.createPaymentIntent(amount); Donation donation = new Donation(); donation.setEmail(email); donation.setPhone(phone); donation.setDonationAmount(amount); donation.setSelectionDate(new Date()); donation.setPaymentMode("Stripe"); donation.setIsPaid(false); donation.setPaymentReferenceID(paymentIntent.getId()); donation.setRemarks("Pending Payment"); donationRepository.save(donation); return "{\"clientSecret\": \"" + paymentIntent.getClientSecret() + "\", \"success\": true}"; } catch (StripeException e) { return "{\"success\": false, \"message\": \"" + e.getMessage() + "\"}"; } } // Update payment status PostMapping("/update-payment-status") public String updatePaymentStatus(RequestParam String paymentReferenceID) { try { Donation donation = donationRepository.findByPaymentReferenceID(paymentReferenceID); if (donation == null) { return "{\"success\": false, \"message\": \"Donation record not found.\"}"; } donation.setIsPaid(true); donation.setPaymentDate(new Date()); donation.setRemarks("Payment Successful"); donationRepository.save(donation); return "{\"success\": true}"; } catch (Exception e) { return "{\"success\": false, \"message\": \"" + e.getMessage() + "\"}"; } } } import com.paypal.api.payments.*; import com.paypal.base.rest.APIContext; import com.paypal.base.rest.PayPalRESTException; import com.paypal.base.rest.OAuthTokenCredential; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; Service public class PayPalService { Value("${paypal.client.id}") private String clientId; Value("${paypal.client.secret}") private String clientSecret; Value("${paypal.mode}") private String mode; public Payment createPayment(Double amount, String returnUrl, String cancelUrl) throws PayPalRESTException { OAuthTokenCredential authTokenCredential = new OAuthTokenCredential(clientId, clientSecret); APIContext apiContext = new APIContext(authTokenCredential.getAccessToken()); apiContext.setConfigurationMap(PayPalConfig.getPayPalConfigMap(mode)); Amount totalAmount = new Amount(); totalAmount.setCurrency("USD"); totalAmount.setTotal(String.valueOf(amount)); Transaction transaction = new Transaction(); transaction.setAmount(totalAmount); transaction.setDescription("Donation Payment"); Payment payment = new Payment(); payment.setIntent("sale"); payment.setPayer(new Payer("paypal")); payment.setTransactions(Arrays.asList(transaction)); RedirectUrls redirectUrls = new RedirectUrls(); redirectUrls.setReturnUrl(returnUrl); redirectUrls.setCancelUrl(cancelUrl); payment.setRedirectUrls(redirectUrls); return payment.create(apiContext); } } import com.paypal.api.payments.Payment; import com.paypal.base.rest.PayPalRESTException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; RestController RequestMapping("/payment") public class PayPalController { Autowired private PayPalService payPalService; Autowired private DonationRepository donationRepository; // PayPal Payment PostMapping("/paypal-payment") public String paypalPayment(RequestParam String email, RequestParam String phone, RequestParam Double amount) { try { Payment payment = payPalService.createPayment(amount, "https://yourdomain.com/return", "https://yourdomain.com/cancel"); Donation donation = new Donation(); donation.setEmail(email); donation.setPhone(phone); donation.setDonationAmount(amount); donation.setSelectionDate(new Date()); donation.setPaymentDate(new Date()); donation.setPaymentMode("PayPal"); donation.setIsPaid(true); donation.setPaymentReferenceID(payment.getId()); donation.setRemarks("Payment Completed"); donationRepository.save(donation); return "{\"success\": true, \"message\": \"Donation recorded successfully.\"}"; } catch (PayPalRESTException e) { return "{\"success\": false, \"message\": \"" + e.getMessage() + "\"}"; } } }
How to Deploy
.NET
- Build the project using Visual Studio or CLI (`dotnet build`).
- Publish the project (`dotnet publish -o ./publish`).
- Deploy on IIS:
- Install the ASP.NET Core Hosting Bundle on IIS.
- Set up a new site in IIS, pointing to the publish folder.
- Update the `appsettings.json` with your database connection string.
PHP
- Host on Apache or Nginx with PHP installed.
- Place backend files in the server directory.
- Update database credentials in the configuration file.
Node.js
- Install Node.js and set up the project directory.
- Deploy using PM2 or on cloud platforms like Heroku.
Java
- Deploy using a web server like Tomcat or on cloud platforms.
- Configure application.properties with database credentials.
Release Notes
Features
Initial release of the Donation Box feature for collecting charitable contributions.
- Donation Form: Users can easily fill out a form to donate with options for specifying the donation amount, and preferred payment method.
- Payment Integration: Integrated with popular payment gateways (Stripe, PayPal) for secure donation transactions.
- Customizable Goal Tracker: Set donation goals and track progress with real-time updates to encourage contributions.
- Recurring Donations: Option for users to set up recurring monthly or annual donations with flexible intervals.
- Donation History: Users can view their past donation history and receipts for tax purposes.
- Donor Acknowledgement: Automatic thank you messages and certificates generated upon successful donation.
Future Plans for Donation Box
Future versions will continue to enhance the donation box system with additional features such as:
- Recurring Donations: Allow users to set up automatic, recurring donations on a weekly, monthly, or annual basis for seamless contributions.
- Donation Progress Tracker: Display a real-time progress bar or goal tracker showing how close the donation box is to reaching its target amount.
- Donor Acknowledgment: Automatically send personalized thank you notes or certificates to donors to show appreciation for their contribution.
- Donation Tiers with Rewards: Introduce tiered donation levels, each with unique rewards or recognition for higher-value donors.
- Anonymous Donations: Allow donors to contribute anonymously for greater privacy and peace of mind.
- Integration with Social Media: Enable users to share their donations on social media platforms to encourage others to donate and raise awareness.
- Tax Receipt Generation: Provide tax-deductible donation receipts automatically generated for donors, making it easier for them to claim charitable contributions.
- Multiple Payment Gateways: Expand payment options to include additional methods like mobile payments, cryptocurrency, or peer-to-peer payment systems.
- Donation Matching: Integrate with organizations that match donations, allowing donors to double their impact on causes.
- Real-Time Updates on Fund Usage: Provide donors with transparent, real-time updates on how their contributions are being used, such as project milestones or financial reports.
- Gamification Features: Introduce fun gamified elements such as badges, leaderboards, or achievements to motivate users to donate more frequently.