Build a Payment Splitter on the Binance Smart Chain (BSC)

A payment splitter is a tool that allows a single payment to be divided and distributed among multiple recipients automatically, eliminating the need for manual calculations and reducing the risk of errors. In this tutorial, you will learn how to build a payment splitter on the blockchain and get started quickly.

By implementing a payment splitter as a smart contract on a blockchain network, you can ensure transparency, security, and automation in the distribution of funds. Whether splitting rent with roommates, dividing commission payments among salespeople, or managing funds in a fundraising campaign, a payment splitter on the blockchain can make your life easier.

This video will show you how to use the payment splitter module boilerplate. But first, let’s start with a more comprehensive understanding of a payment splitter Dapp.

Use cases of Payment Splitter.

A payment splitter is a useful tool that can simplify dividing and distributing funds among multiple recipients. There are many different use cases for a payment splitter, including:

  1. Group expenses: A payment splitter can divide the cost among multiple people for group expenses, such as a vacation or team outing. For example, a group of friends might use a payment splitter to divide the cost of a rental house for a beach vacation.
  2. Sharing rent or bills: A payment splitter can split rent or bills among roommates or housemates. For example, if four people share an apartment, they might use a payment splitter to divide the rent and utilities evenly.
  3. Fundraising: For fundraising campaigns, a payment splitter can allocate funds to multiple recipients, such as different causes or organizations. For example, a charity organization might use a payment splitter to distribute funds raised through a crowdfunding campaign to several beneficiaries.
  4. Commission payments: A splitter can divide commission payments among the relevant employees for businesses with multiple salespeople. For example, a sales manager might use a payment splitter to divide commission payments among the sales team based on their sales.
  5. Crowdfunding: A payment splitter can be used in crowdfunding campaigns to distribute funds among multiple creators or contributors. For example, a group of artists might use a payment splitter to distribute funds raised for a project to each artist involved.
  6. Escrow services: Payment splitters can be used as an escrow service for transactions, distributing funds to multiple parties based on predefined conditions. For example, a payment splitter might distribute funds in a real estate transaction, releasing payment to the seller once the buyer has inspected the property and confirmed that it meets the agreed-upon conditions.

Steps to build a payment splitter

To build a payment splitter, you must create a smart contract on a blockchain platform that supports smart contracts, such as Ethereum and EVM-based blockchains like Polygon, Binance Smart Chain (BSC), etc. Here are the general steps to build a payment splitter:

  1. Choose a blockchain platform: Choose a blockchain platform that supports smart contracts and has the features you need to build your payment splitter.
  2. Define the split ratios: Determine the split ratios for the payment splitter, which will determine how incoming payments will be divided and distributed to the different recipients.
  3. Write the smart contract code: Write the smart contract code for the payment splitter in the programming language supported by the chosen blockchain platform or deploy already made smart contract modules on Bunzz. The code should include the logic for dividing incoming payments according to the defined split ratios.
  4. Test the smart contract: Test the smart contract thoroughly to ensure that it works as intended and is free of bugs.
  5. Deploy the smart contract: Deploy the smart contract to the blockchain network and make it available to users.
  6. Monitor the smart contract: Monitor the smart contract after deployment to ensure that it is functioning properly and that there are no issues with the split ratios or other aspects of the contract.

These are the general steps to build a payment splitter, but the specific steps and details may vary depending on the blockchain platform and the requirements of your payment splitter. It’s important to ensure that your payment splitter is built correctly and meets your needs.

A QuickStart to build your Payment Splitter

We understand developers’ challenges and complexities when working with blockchain technology and smart contracts, so we have created a boilerplate code to make your life easier. With our boilerplate code, you can get a head start on building a payment splitter, allowing you to focus on adding your unique features and customizing the tool to fit your needs.

Payment spiltter boilerplate front page

Things to Know Before Using Payment Splitter Boilerplate

The payment splitter DApp boilerplate was built using the following:

  • React.js for the Front-End and user interface
  • Web3.js and ethers.js to interact with smart contracts deployed from Bunzz
  • Binance Smart Chain (BSC) Testnet Network

These smart contracts modules were deployed from Bunzz (you’ll need to deploy all three (3) contracts to use the boilerplate successfully):

The DApp boilerplate can perform the following:

  • Manage (Add payee, Remove payee, Update shares) payees.
  • Release and send Eth and ERC20 Tokens to payees on the Front-End.

How to use the Payment Splitter Boilerplate 

As introduced in the video above, here are key steps to get started with the vesting wallet Boilerplate and make sure you have everything needed to run and customize the boilerplate for your use case.

  1. Clone the GitHub repository of the Payment Splitter Boilerplate to your local computer.
  2. Open the cloned repository using your preferred IDE, such as Visual Studio Code.
  3. Install the necessary NPM packages by running npm install in the terminal.
  4. Replace the existing smart contract address and ABI with the ones you have deployed from Bunzz.
  5. Start the app by running npm start.
  6. Edit and customize the code to fit your specific use case, such as changing the interface or adding new features.

By following these steps, you will have everything you need to get started building a payment Splitter and customize it for your use case.

We can’t wait to see what you’ll build; if you follow these steps and get stuck or have any questions, feel free to reach out on Discord or send a DM on Twitter.

Share this article: