Taxes
Bill contracts can be used to do people's taxes. Suppose we want to process taxes for user A who is a merchant on CanCan.
Let's setup our Bill contract to process taxes for User A at the end of each month.
The first step is to deploy a Bill contract (with the Is Payable parameter set to No since we are not going to be paying the user) like we did on this page
Bill contracts enable you to account for all credits/debits to an account.
You can also add a credit factor that multiplies all the credits and a debit factor that multiplies all the debits in an equation that gives an end value which in our case will be the monthly tax.
All taxes can be written in this format: debit_factor * debit - credit_factor * credit = tax
Setting Up You Bill's Factors
To setup the credit and debit factors of your bill, go your Bill contract and click on the Details button to reveal its panel.
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-ed4f18b89290e5aa79e0c2cbefb2228a378b677b%252Fbill4.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=abe7022a&sv=1)
Click on the Control Panel button to reveal its menu and select the Update Migration Point option
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-1fa2e8d7a5fafdf1d5dd1cced3f5a52d9fdb1000%252Fbill10.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5b9d4397&sv=1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-599e0a0b7a5a3cba8e4049fc7e7ed14a4a21a637%252Fbill11%2520%281%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=3c57078a&sv=1)
We are setting our factors to be 100% so our monthly taxes due on an account could just be computed as all credits - all debits.
We will just need to update each account on all credits/debits to an account each month. That way the account owner will know at the end of each month, how much taxes he/she needs to pay.
The next step will be for account owners to pay their taxes through the Bill contract and for the Bill admin to withdraw the paid taxes and send the funds to the IRS or whichever branch of the government is in charge of taxes in your country.
Creating User A's Account
The next step is to create your user's accounts. Let's create User A's account then Click on the Details button of your Bill contract to reveal the panel
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-ed4f18b89290e5aa79e0c2cbefb2228a378b677b%252Fbill4.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=abe7022a&sv=1)
Since User A is paid in USD, let's select the USD tFIAT token. Click on the Select a currency button to reveal the token wizard like in the image below. Click on the Manage Tokens button to reveal the form on the right, activate the PaySwap Onramp tokens then go back to the previous form
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-a20c01c4022c2b4224e0d3665ec9ea0e0869205d%252Framp_select_token.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=aa60c3eb&sv=1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-0b4728d1f16db59d102765671efb14a1de0e54d0%252Framp_select_token2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=61477284&sv=1)
Search for and select the USD tFIAT token
You should now have the USD selected in the drop down field on top of your Control Panel button. Click on the Control Panel button to show the control panel's menu
Click the Create/Update Account button; fill in the form on the right image below. Make sure you read the description for each parameter in order to provide the correct value
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-e9c28cb437beb6d2edad63fb012ad47bdf9a0f7d%252Fbill7.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6e06ab1e&sv=1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-a83c73d25ee6976a9a322873e4a6c4d11a748591%252Fbill5%2520%281%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=eaf5fda5&sv=1)
We set the Period Receivable to the duration of a month in a minutes since we will be doing User A's taxes every month
We also set the Start of the account to October 20th, 2023 which is when the contract start counting the Period Receivable from
Lastly, we set the Description of our account and validate the transaction
Reload the page and tick the Mine Only button to only show your Bill contracts (this should enable you to find your Bill contract faster)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-99afdd166f39772be06518b83e99fdc1007ad1e4%252Fbill8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=348bdb16&sv=1)
Click on the Details button to reveal the panel of your Bill contract. You should be able to see at the bottom left of the panel, your account's ID. Click on the ID to display the parameters of the account like we did by clicking on our account's ID in the image below (our account ID is 1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-4f0ae424bee29289e73bba61552174d7a5a5be4e%252Fbill12.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=da183238&sv=1)
Other details like the amount of tax the account owner needs to pay (which is computed with the formula: debit_factor * debits - credit_factor * credits) are available in the parameter section of the Bill contract once you select the right account. In our case, the tax amount is the Due Payable
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-f70931d3fcdbb5e7ef7e41c444e28e5804a5cc1c%252Fbill16.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c7493f25&sv=1)
Notifying Account Credits
Got to your Bill contract's panel and select the account to notify by its ID available at the bottom left of your panel
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-4f0ae424bee29289e73bba61552174d7a5a5be4e%252Fbill12.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=da183238&sv=1)
Go to your control panel's menu and select the Notify Credit button and fill in the Credit Address parameter with your own wallet address since you are the one notifying the contract. In case you are not the admin of the Bill, you should input in here the address of a contract approved to notify your Bill contract of Credit & Bill operations. Also enter the amount of the credit; this is in the currency of the account being notified.
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-385e8118c6391bf3ce4fe95370155a0f67c111c8%252Fbill13.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6a26ef86&sv=1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-2e3c0ae62e8a6009abd2e78aab8ffb34260d0604%252Fbill14.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=bb3b4796&sv=1)
Validate and confirm the operation. You should see the update reflected in the parameter section of your Bill contract once you select your account's ID
Notifying Account Debits
Got to your Bill contract's panel and select the account to notify by its ID available at the bottom left of your panel
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-4f0ae424bee29289e73bba61552174d7a5a5be4e%252Fbill12.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=da183238&sv=1)
Go to your control panel's menu and select the Notify Debit button and fill in the Debit Address parameter with your own wallet address since you are the one notifying the contract. In case you are not the admin of the Bill, you should input in here the address of a contract approved to notify your Bill contract of Credit & Bill operations. Also enter the amount of the debit; this is in the currency of the account being notified.
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-385e8118c6391bf3ce4fe95370155a0f67c111c8%252Fbill13.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6a26ef86&sv=1)
![](https://docs.payswap.org/~gitbook/image?url=https%3A%2F%2F3481829468-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FbuuWgsRQF3QPmDvV7XJQ%252Fuploads%252Fgit-blob-2f8217c2587063ed6c20905f704fc9a92192f72a%252Fbill15.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c42ee1c6&sv=1)
Validate and confirm the operation. You should see the update reflected in the parameter section of your Bill contract once you select your account's ID
Last updated