#Your Developer - API Integration
1 messages ยท Page 1 of 1 (latest)
HI ๐
Can you tell me a little about your situation? What are you trying to build, and what APIs do you plan on using?
i am going to create an on demand platform for cleaners
i need some help regarding tax and payouts
Okay. What are your questions?
currently when a customer creates an account i am creating a stripe customer and i save the customer id
after that when the customer add a payment method i create a payment method on stripe using the api and attach it to the customer
when the customer try to pay i create a payment intent
with the payment method and the customer id
is this flow correct ?
Yes. so far this sounds perfectly normal
ok now i want to add the tax amount for the order
currently i am charging the total amount from the customer
total = sub total+ gst
but i found stripe has a way to add tax but i can't understand it
We actually have multiple ways, depending on how you integrate. You can read about both solutions here:
https://stripe.com/docs/billing/taxes/collect-taxes
Please at least read the first two bullet points as that is core to understanding what solution will work for you
As the docs state (please read), Stripe Tax is a paid service. Tax Rates are a free feature but they apply more narrowly.
Okay
Well Stripe Tax automates tax collection so that might not work in this use case. Tax Rates allow you to define your own tax rates but they only apply to Invoices, Subscriptions, and Checkout
can i use tax rates in my platform
no i have created a payment intent with the details
Then no, you won't be able to use Tax Rates. In that case you'll need to calculate that on your end and include it in the total. I think that's what you are currently doing.
yes that is the current way we are doing
is there any service in stripe that we can use
{
amount: amount,
currency: "aud",
customer: customer,
payment_method: paymentMethodId,
off_session: false,
confirm: true,
confirmation_method: "manual",
transfer_data: {
destination: "",
},
application_fee_amount: amount/10,
},
{ idempotencyKey }
);```
this is my current implementation
You would need to either sign up for Stripe Tax (in which case we would automatically determine and collect tax rates) or change your integration to use Checkout, Invoices, or Subscriptions.
since this is a on demand platform for cleaners
we have to do the payouts
so i am adding the connected account id in the destination
What kind of Connect accounts are you using?
but then the cleaner will get the total amount including tax
i didnt get that
Standard, Express, or Custom accounts. Also what type of charge are you using (Direct, Destination, Separate Change & Transfer)?
it is a express account
i have added the destination here to add the amount to the cleaner
Hello! I'm taking over and catching up now, give me a minute. ๐
๐ ok
Okay, so you're trying to calculate tax and use Payment Intents?
yes
what is the best way to calculate the tax
if i add it in the total amount then the cleaner will get that amount also
You need to calculate the tax on your end if you're using Payment Intents directly.
Stripe can only calculate tax if you're using Checkout, Invoices, or Subscriptions.
For Payment Intents directly you would calculate the tax on your end and include it in the Payment Intent's amount.
You would need to calculate that on your end as well so the right amount is calculated.
Can you check this
What would you like me to check it for?
I have added the destination there
So the cleaner will receive the total amount from the order
What do you want me to check though?
In that code destination is set to an empty string, so that's not going to work. Is that what you're asking about?
No I have removed the value there when adding the code here
Okay, so I don't understand what you want me to check. What is your question about that code?
You told me that I have to calculate the tax from my end and add it right
Yes.
When i add it then the cleaner will receive the subtotal + tax
The cleaner should only receive the sub total
Not the tax amount
Did you get my issue ๐
They will receive whatever you specify in amount minus whatever you take as a fee in application_fee_amount.
So if amount is set to 1000 and application_fee_amount is set to 200 then the account you specify as the destination will end up with 800.
Is that what you're asking?
The tax is entirely separate from all of this.
Payment Intents do not have any concept of tax.
The tax would be included in the amount.
You would calculate it before this.
I am calculating it but how can I charge it
Going back to that example, the subtotal could have been 900 and the tax was 100, for a total amount of 1000.
Sorry, I don't understand your question. Can you explain with more detail? What exactly is your issue?
How can i stop the cleaner from receiving the tax amount
In your example the total is 1000
Wait ill send a example
lets imagine the subtotal is 900 . and the tax is 100 . the total amount will be 1000. The cleaner should get his cut from the 900 , not from 1000
that is my issue
I still don't understand what your issue is. You would calculate that on your end and set the amount and application_fee_amount to the proper values.
What about the tax
Did you get this
Yeah, I got it.
Okay, let's go through it from the start.
You have a subtotal of 900. Tax is 100.
You want the destination account to get 10% of the 900, correct?
Err.
They would get 90% of it.
You as the platform would get 10%.
Right?
Okay, so you calculate that out and determine that the destination gets 810 of the subtotal and you get 90 as the platform, correct?
Yes
Okay, so that takes care of the subtotal. Now there's the 100 tax. Where do you want that to go?
Does it go to you as the platform or to the destination account?
This is my first time creating a platform like this . Is this way wrong?
Woah, let's not go off the rails here, let's finish this example all the way to the end.
We have to collect taxes and pay back isnt it?
Simple question: you're charging 100 for tax. Where does that 100 end up? Your platform account or the destination account?
Platform account
Okay, so you would add the 100 to the 90 for a total application_fee_amount of 190 going to your platform account. The other 810 goes to the destination account. The amount on the Payment Intent is set to the 1000 grand total.
Does all of that make sense?
Okay, so does that solve your issue, or is there still an outstanding problem/question?
So i have to change the above code right
Yes.
Is there any feature that i can use in stripe to add that tax separately
Not if you're using Payment Intents directly, no. You would need to switch to Checkout, Invoices, or Subscriptions to use Stripe Tax.
Is it possible to migrate the above code
Not really. You would need to write new code.
Checkout is the easiest way to use Stripe Tax, I recommend you start there: https://stripe.com/docs/tax/checkout
I am creating the mobile app using flutter so i am using cloud functions
Ah, okay. I still recommend investigating Checkout (you can open it in a web view in your app), but if you don't want to use that you would need to use Invoices: https://stripe.com/docs/tax/invoicing
so can i use the stripe customer id , payment methods there ?
Yes.
can you send me a reference to use invoices or checkout for to collect payments for connected accounts ?
like the one i have currently done
We don't have a specific reference for that combination. You'll need to read through the guides and the API reference to create a solution for your specific use case.
ok. can i add a destination in checkout or invoice so the connected account can get paid
Yes, in Checkout you can set the destination here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_data-destination
wait i am checking it
For Invoices you can set destination here: https://stripe.com/docs/api/invoices/create#create_invoice-transfer_data-destination
what is the best method for on demand apps according to your opinion
What do you mean by, "on demand apps"?
You mentioned you're using Connect with Express accounts, right? That's my primary recommendation as the best path forward for an app like that. When it comes to specifics like tax I don't really have a recommendation as it depends on the unique needs of your business.
i am asking about collecting payment part
payment intents , checkout , invoices
what is the most suitable way according to your idea
Yeah, that's the part that's up to you based on your business needs.
I recommend reading about all those options so you know what the pros and cons are for each for your use case, then use the one with the most pros and fewest cons for you.
i think i have to go with checkout or invoices because i have to add the tax
Those taxes we collect we have to give them back right ?
If you want Stripe to calculate the tax then yes, you do. If you calculate the tax some other way you can use Payment Intents directly.
Give them back? What do you mean?
i mean the tax
Yeah, but I don't understand what you mean by give the taxes back. Give them back to who? When? What do you mean?
i mean the taxes we collect we have to give those to the state
Yes, that's how taxes work. I'm not clear on your question though?
We have details about Payout timing here: https://stripe.com/docs/payouts#payout-schedule
And some additional info about Connect here: https://stripe.com/docs/connect/manage-payout-schedule
perfect ill check it