#Your Developer - API Integration

1 messages ยท Page 1 of 1 (latest)

cursive star
#

HI ๐Ÿ‘‹
Can you tell me a little about your situation? What are you trying to build, and what APIs do you plan on using?

mossy ore
#

i am going to create an on demand platform for cleaners

#

i need some help regarding tax and payouts

cursive star
#

Okay. What are your questions?

mossy ore
#

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 ?

cursive star
#

Yes. so far this sounds perfectly normal

mossy ore
#

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

cursive star
#

Please at least read the first two bullet points as that is core to understanding what solution will work for you

mossy ore
#

is stripe getting a cut from the tax amount ?

#

if i use stripe tax

cursive star
#

As the docs state (please read), Stripe Tax is a paid service. Tax Rates are a free feature but they apply more narrowly.

mossy ore
#

i want to add 7% for the sub total

#

for the payment

cursive star
#

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

mossy ore
#

can i use tax rates in my platform

cursive star
#

Is your platform using Invoices, Subscriptions, or Checkout?

mossy ore
#

no i have created a payment intent with the details

cursive star
#

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.

mossy ore
#

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

cursive star
#

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.

mossy ore
#

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

cursive star
#

What kind of Connect accounts are you using?

mossy ore
#

but then the cleaner will get the total amount including tax

mossy ore
cursive star
#

Standard, Express, or Custom accounts. Also what type of charge are you using (Direct, Destination, Separate Change & Transfer)?

mossy ore
restive elbow
#

Hello! I'm taking over and catching up now, give me a minute. ๐Ÿ™‚

mossy ore
#

๐Ÿ˜ƒ ok

restive elbow
#

Okay, so you're trying to calculate tax and use Payment Intents?

mossy ore
#

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

restive elbow
#

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.

mossy ore
#

But then the amount the cleaner will receive will charge

#

That is the issue

restive elbow
#

You would need to calculate that on your end as well so the right amount is calculated.

mossy ore
restive elbow
#

What would you like me to check it for?

mossy ore
#

I have added the destination there

#

So the cleaner will receive the total amount from the order

restive elbow
#

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?

mossy ore
#

No I have removed the value there when adding the code here

restive elbow
#

Okay, so I don't understand what you want me to check. What is your question about that code?

mossy ore
#

You told me that I have to calculate the tax from my end and add it right

restive elbow
#

Yes.

mossy ore
#

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 ๐Ÿ™

restive elbow
#

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?

mossy ore
#

What about the tax

#

The tax is not a application fee

restive elbow
#

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.

mossy ore
#

I am calculating it but how can I charge it

restive elbow
#

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?

mossy ore
#

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

restive elbow
#

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.

mossy ore
#

What about the tax

restive elbow
#

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?

mossy ore
#

Yessss

#

The application fee is 10%

#

Yes you got it

restive elbow
#

Okay, so you calculate that out and determine that the destination gets 810 of the subtotal and you get 90 as the platform, correct?

mossy ore
#

Yes

restive elbow
#

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?

mossy ore
#

This is my first time creating a platform like this . Is this way wrong?

restive elbow
#

Woah, let's not go off the rails here, let's finish this example all the way to the end.

mossy ore
#

We have to collect taxes and pay back isnt it?

restive elbow
#

Simple question: you're charging 100 for tax. Where does that 100 end up? Your platform account or the destination account?

mossy ore
#

Platform account

restive elbow
#

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?

mossy ore
#

Yes

#

Exactly

restive elbow
#

Okay, so does that solve your issue, or is there still an outstanding problem/question?

mossy ore
#

So i have to change the above code right

restive elbow
#

Yes.

mossy ore
#

Is there any feature that i can use in stripe to add that tax separately

restive elbow
#

Not if you're using Payment Intents directly, no. You would need to switch to Checkout, Invoices, or Subscriptions to use Stripe Tax.

mossy ore
#

Is it possible to migrate the above code

restive elbow
#

Not really. You would need to write new code.

mossy ore
#

Yes yes i mean can i get the same functionality

#

Can you send me a reference

restive elbow
mossy ore
#

I am creating the mobile app using flutter so i am using cloud functions

restive elbow
#

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

mossy ore
#

so can i use the stripe customer id , payment methods there ?

restive elbow
#

Yes.

mossy ore
#

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

restive elbow
#

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.

mossy ore
#

ok. can i add a destination in checkout or invoice so the connected account can get paid

restive elbow
mossy ore
#

wait i am checking it

restive elbow
mossy ore
#

what is the best method for on demand apps according to your opinion

restive elbow
#

What do you mean by, "on demand apps"?

mossy ore
#

like uber

#

i am creating a on demand cleaning service app where you can book a cleaner

restive elbow
#

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.

mossy ore
#

i am asking about collecting payment part

#

payment intents , checkout , invoices

#

what is the most suitable way according to your idea

restive elbow
#

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.

mossy ore
#

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 ?

restive elbow
#

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?

mossy ore
#

i mean the tax

restive elbow
#

Yeah, but I don't understand what you mean by give the taxes back. Give them back to who? When? What do you mean?

mossy ore
#

i mean the taxes we collect we have to give those to the state

restive elbow
#

Yes, that's how taxes work. I'm not clear on your question though?

mossy ore
#

no i understood it

#

and also how much time it will take for a payout

restive elbow
mossy ore
#

perfect ill check it