DonorBox
Easily integrated With
donorbox
Plug and Play
Instant Donations. Efficient, scalable, and ready to integrate!

Simple Connect with your website or app. Easily integrated with Node.js, .NET Core, PHP, and Java – Complete documentation provided.

in just$20$25 Limited Time Offer
Also Available On:

What is DonorBox ?

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.

Easily integrated With

Watch Demo

See DonorBox Plug and Play in action! Watch the demo video below to explore the user-friendly interface and seamless workflow that make donation management effortless.

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.

  • 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.
  • 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
    Switch between day and night modes for a more comfortable viewing experience depending on the time of day. The system automatically adjusts for low light environments.
  • 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

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 chat 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 PayPal API key:

  • Go to PayPal Developer Dashboard.
  • Navigate to "My Apps & Credentials" and click "Create App" or select an existing app.
  • Fill in the app details and click "Create App."
  • Once the app is created, you'll find the **Client ID** and **Secret** under the app details.
  • Use sandbox credentials for testing and live credentials for production.
  • For more details, visit PayPal's API documentation.

To generate Stripe API keys:

    • Go to Stripe Dashboard.
    • Click on "Developers" in the sidebar, then "API Keys."
    • You'll find the **Publishable Key** and **Secret Key** listed. Use these keys for integration.
    • Use test keys for testing and live keys for production.
    • 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 (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 Core
  1. - Build the project using Visual Studio or CLI (`dotnet build`).
  2. - Publish the project (`dotnet publish -o ./publish`).
  3. - Deploy on IIS:
  4. - Install the ASP.NET Core Hosting Bundle on IIS.
  5. - Set up a new site in IIS, pointing to the publish folder.
  6. Update the `appsettings.json` with your database connection string.
PHP
  1. - Host on Apache or Nginx with PHP installed.
  2. - Place backend files in the server directory.
  3. - Update database credentials in the configuration file.
Node.js
  1. - Install Node.js and set up the project directory.
  2. - Deploy using PM2 or on cloud platforms like Heroku.
Java
  1. - Deploy using a web server like Tomcat or on cloud platforms.
  2. - Configure application.properties with database credentials.

Release Notes

Features

Initial release of the Donation Box feature for collecting charitable contributions.


  1. Donation Form: Users can easily fill out a form to donate with options for specifying the donation amount, and preferred payment method.

  2. Payment Integration: Integrated with popular payment gateways (Stripe, PayPal) for secure donation transactions.

  3. Customizable Goal Tracker: Set donation goals and track progress with real-time updates to encourage contributions.

  4. Recurring Donations: Option for users to set up recurring monthly or annual donations with flexible intervals.

  5. Donation History: Users can view their past donation history and receipts for tax purposes.

  6. Donor Acknowledgement: Automatic thank you messages and certificates generated upon successful donation.

Future Plans for DonorBox

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.

Get in touch with us now to learn more!

Your website is a tireless employee, working around the clock, 24 hours a day, 7 days a week, without rest or break. It is the face of your business, representing you to the world, and it needs to be the best it can be. That's why you can trust the expert team at AM-Technology to create the ultimate employee for your business - a website that works for you, day and night.

Contact us
Chat with us