SDK
Before getting started, please obtain your API keys from the dashboard and deploy your Business Auto account through the Shakesco app.
Refer to the Integration guide for instructions on parsing values. Additionally, visit the Start section to ensure your auto-payment account is configured to process payments.
If you want to test out the system, just go here.
@shakesco/automation
This repository makes it easy for businesss to interact with their autopayment contract and enable automation!
Before intergrating please read this short explanation on how the system works. It will help you understand how you may want to setup your auto-payments.
Install
npm i @shakesco/automation
After installing:
const { Automation, parseUnits } = require("@shakesco/automation");
Test
Before getting started, send a test request to make sure everthing is okay.
Request test address
First, request a delegate address by entering your business smart wallet address (it’s the same for both Ethereum and Polygon) along with your API key:
const your_smart_wallet_address = "";
const shakescocontract = new Automation(
your_smart_wallet_address,
process.env.SHAKESCOAPIKEY,
"11155111"
);
const requestAddress = await shakescocontract.testDelegateAddressBuss(); //request test address
console.log(requestAddress);
// {
// id: "1",
// test_delegate_address: "0x472ef8282b420396ad307cb89f542e60b1dec1a1",
// }
Test Request
Then send a request:
const address = ""; // Your test delegate address you requested above
const shakescocontract = new Automation(
address,
process.env.SHAKESCOAPIKEY,
"11155111");
const period = "86400" //1 day
const requestUser = await shakescocontract.requestUser(
"0x309E7d835ccE6E74BC72A2E523fa7f79FFC0d413", // parse this address
"",
period,
"",
false,
[],
[]);//request user
console.log(requestUser);//Requested user successfully
Live
Request user
Send request to user. Ask user for Shakesco card/ Business card address.
const address = /* Initialize your automation address. Can be found in your dashboard https://users.shakesco.com */
const shakescocontract = new Automation(address, process.env.SHAKESCOAPIKEY, "1");
const period = "604800" //1 week
const amount = parseUnits("20", 18); //amount to request regularly
const delegateAddress = /*Ask user/business for their Shakesco card/delegate/business card ONLY.*/;
const requestUser = await shakescocontract.requestUser(delegateAddress, "", period, amount, false, [], []);//request user
const requestBusiness = await shakescocontract.requestBusiness(delegateAddress,"", period, amount);//or request business
console.log(requestUser);//Requested user successfully
console.log(requestBusiness);//Requested business successfully
Request Split payment
When you want to request split payment:
const address = /* Initialize your automation/Shakesco auto/business auto address. Can be found in your dashboard https://users.shakesco.com */
const shakescocontract = new Automation(address, process.env.SHAKESCOAPIKEY, "1");
const period = "604800" //1 week
const mainAddress = /** Users Shakesco card/delegate/business card ONLY.*/
const friends = ["", ""]; //request friend details. Shakesco card/delegate/business card ONLY.
const friendsAmount = [parseUnits("10", 18), parseUnits("10", 18)];
const mainamount = parseUnits("10", 18);
const requestUser = await shakescocontract.requestUser(mainAddress, "", period, mainamount, true, friends, friendsAmount);//request user
console.log(requestUser); //Requested user successfully (Returns for mainAddress only)
//so check the rest, "friends".
for (let i = 0; i < friends.length; i++) {
const isrequested = await shakescocontract.isRequested(friends[i]);
console.log(isrequested); // true / false
}
Request Tokens
When you want to request a token:
const address = /* Initialize your automation address. Can be found in your dashboard https://users.shakesco.com */
const shakescocontract = new Automation(address, process.env.SHAKESCOAPIKEY, "137");
const period = "604800" //1 week
const amount = parseUnits("20", 18); //amount to request regularly
const delegateAddress = /*Ask user/business for their Shakesco card/delegate/business card ONLY.*/
const tokenAddress = "" //Make sure it is checksummed
const requestUser = await shakescocontract.requestUser(delegateAddress, tokenAddress, period, amount, false, [], []);//request user
const requestBusiness = await shakescocontract.requestBusiness(delegateAddress, tokenAddress, period, amount);//or request business
console.log(requestUser);//Requested user successfully
console.log(requestBusiness);//Requested business successfully
Check payment status
To check if user has made payment or not:
const address = /*Initialize your automation address*/
let delegateAddress = /*Request user for their info: Shakesco card/delegate/business card address ONLY*/
const shakescocontract = new Automation(address, process.env.SHAKESCOAPIKEY, "137");
const requestUser = await shakescocontract.hasPaid(delegateAddress);
console.log(requestUser); //"true"
We also don’t offer daily automation. If your business requires daily automation please reach out to us!
ENJOY YOUR FINANCIAL FREEDOM😁!!!