Hi,
I'm pretty sure that many of us suffering when we need to enter manually Shopify's transaction (payout, merchant) fee.
I came up with not too elegant (I'm not a coder) but a very efficient flow to automate the creation of a bill after every Shopify order.
This flow automatically calculates the payout fee. No more manual data entry!
Let's build the flow
1. Zoho flow trigger: Paid Shopify order created
2. Add a Decision Box.
3. We are using 2 different payment method (Shopify, PayPal), we accept AMEX card and sometimes we have customers from overseas hence we have 4 conditions
- AMEX: Tags equals AMEX -> for this you need to use
Ablestar's Automatic Order Tag app. Set up a rule (it's free) when an order is created and the credit card company is American Express then it adds AMEX as a tag.
- Overseas payment: Gateway contains shopify AND Billing address - Country does not contain Australia
- Shopify payments: Gateway contains shopify
- PayPal payments: Gateway contains paypal
The AMEX and overseas payments' fees are 2.9% + 30 cent
Shopify payment's fee is 1.75% + 30 cent
PayPal payment's fee is 2.6% + 30 cent
To go forward you need to create 2x custom functions. Just copy and paste the below codes.
- Date format:
string dateFormat(string dateStr, string fromFormat, string toFormat)
{
dateObj = dateStr.toTime(fromFormat);
return dateObj.toString(toFormat);
}
- Payment calculator
float shopifyPayment(float totalPrice, float percent)
{
paymentFee = totalPrice * percent + 0.3;
return paymentFee;
}
Let's continue the flow.
4. Connect the shopifyPayment custom function box the Decision box:
- totalPrice: ${trigger.total_price}
- percent: for Shopify it's 0.0175, for PayPal it's 0.026 and for the rest is 0.029
5. Connect the dateFormat custom function box to the shopifyPayment box:
- dateStr: ${trigger.created_at}
- fromFormat: yyyy-MM-dd'T'HH:mm:ss
- toFormat: yyyy-MM-dd
6. Add Zoho Inventory - Fetch item (beforehand you need to create a Merchant fee service in Zoho inventory)
- Search by: Name
- Search value: Merchant fee
7. Add Zoho Inventory - Create Bill
Let me know if something is not clear.