#raphael-rodriguez_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1328782610721280041
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! The error indicates you can't do that because you're responsible for negative balances on the account in question, which is accurate. If you're responsible for negative balances you can't disconnect the account from your platform.
I am currently in test mode
And i don't really understand the error response
I don't get how I have a negative balance if the user already received all their money
It's not about their current balance, it's about the fact that if they have any negative balance, now or in the future, you're responsible for it.
Sorry, I think we're talking past each other.
This is not about the account having a negative balance now.
This is about your platform being responsible for any potential negative balance on this account in the future.
Does that make sense?
Ohhh I understand
Seems that my platform has the negative balance
okay well then let me ask you this
okay
Well how do i fix the issue would be the next question
is there something I have to complete?
Look at the error message:
You cannot call deauthorize on acct_1QgCz8IjfsjR6d0g because you're responsible for negative balances on this account.
That does not say "because you have a current negative balance" or "because the connected account has a current negative balance". It says you, the platform, are responsible for negative balances on the account in general.
Can you tell me more about what you're trying to do at a high level? What's your ultimate goal?
Just simply deleting a user
from my application
and since I cannot directly delete a user from stripe, i am simply deauhtorzing
from ym platform
my*
That's not a simple operation. What end state do you want to end up in? Why are you deleting them?
Again, I am just testing
If say a user wants to discontinue with my application, I am giving them the option to
Have you tried deleting the account? https://docs.stripe.com/api/accounts/delete
Is it possible to delete a connected platform account instead of simply just deleting them
Because sources tell me otherwise
I don't understand your question, sorry. Can you provide more context and details?
That question and answer are from 2021 and are horribly out of date.
That also applies to the OAuth flow, which is deprecated and not what you're using.
So, back to my question above, have you tried to delete the account? https://docs.stripe.com/api/accounts/delete
No i have not
Give that a try and see if it does what you want.
okay it worked
thank you
sorry for the trouble
while i still have you
I want some clarification on something
Sure, what's up?
So say my connected account is chraging 40$ for an item
I want the connected account to recieve a total of 40$, which means I would have to add the stripe api cost to the subtotal
I would also like to charge a platform fee that would also add to the subtotal
how would I do this so i can prevent a neagtive balance
Can you clarify exactly who's paying for what? There are three parties: the platform, the connected account, and the customer paying. Do you want the customer to pay $40 or do you want them to pay more than that to cover transaction fees and platform fees?
I would want the customer to pay more
Okay, so you'd charge the customer for more, then fees would be taken, then send $40 to the connected account, keeping the rest as your platform fee.
yes
Sorry, that was my answer to your question. Are you looking for more info than that?
yes, let me give you my current code
one momenty
I just want you to see if it seems that it will work
line_items = []
for service in services:
base_price = int(service.get("price")) * 100 # Convert to cents
platform_fee = int(base_price * 0.050) # 5.0% platform fee
stripe_fee = int(base_price * 0.029 + 30)
total_amount = base_price + platform_fee + stripe_fee
line_items.append({
"price_data": {
"currency": "usd",
"product_data": {
"name": service.get("serviceName"),
"description": service.get("description")
},
"unit_amount": total_amount, # Total amount including fees
},
'quantity': 1
})
bussiness_owner = users.find_one({"uid": appt.get("professional_id")})
if not bussiness_owner:
raise NotFoundError("Business Owner not found")
if not bussiness_owner.get("stripe_id"):
raise PreconditionFailedError("Business Owner has not completed Stripe Registration")
session = stripe.checkout.Session.create(
line_items=line_items,
payment_intent_data={
"application_fee_amount": int(sum(
int(service.get("price")) * 100 * 0.050
for service in services
))
},
mode="payment",
return_url=f"http://localhost:3000/Appointments/Calendar/return?session_id={{CHECKOUT_SESSION_ID}}&stripe_account={bussiness_owner.get("stripe_id")}&appt_uuid={appt_uuid}",
ui_mode="embedded",
stripe_account=bussiness_owner.get("stripe_id")
)
return jsonify(clientSecret=session.client_secret, id=session.id)
We can't review code like that here, or tell you what will happen when it runs. You can run this in test mode and see if it works the way you expect, though.