#some1ataplace_api

1 messages ยท Page 1 of 1 (latest)

limber umbraBOT
#

๐Ÿ‘‹ 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/1311171752579170325

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

atomic yew
#

In terms of tipping the connect id, anybody could tip them one time, daily, monthly, yearly, weekly, etc.

neon pivot
#

Hi! Regarding the submit_type, it customises relevant text on the page, such as the submit button. In this case, you can choose what you want.

#

Can I check if you are allowing tips for both your platform and the connected account in one Checkout session? This is not possible.

#

For the tips for the connected account, what is your fund flow? Will the tips go directly to the connected account's balance or will it go to your platform's balance and then you will transfer it to the connected account?

atomic yew
#

no, I have separate checkout sessions for tipping my website and another for tipping the connect id

#

funds will go directly to the connect accounts balance and will be transferred right away

#

I am trying to figure out how to tip to a single connect id. I am not sure if it would be the same way.

#

I was planning to use a payment intent success webhook to make the transfer to the connect account as well. I mainly need to figure out how to make the checkout session for the connect id

neon pivot
atomic yew
#

express

#

i could have sworn there was a way in the checkout session to transfer to the connect id too, it has been a while since i have looked

neon pivot
atomic yew
#

ah yes, so in this case for me and python it would be this:

payment_intent_data={
"application_fee_amount": 123,
"transfer_data": {"destination": '{{CONNECTED_ACCOUNT_ID}}'},
},

So then I would not need to use a webhook?

#

And I would not need another product id?

#

how would i configure the checkout to handle subscription payments to that connect id?

neon pivot
#

So then I would not need to use a webhook?
Yes, you don't need it.

#

Thought you will want to use the webhook to check if the payment is successful. Not to transfer to the connected account.

#

And I would not need another product id?
Yes, you will not need another product ID.

atomic yew
#

but hold on a second, let's say I only want to transfer 50% of the payment to the connect id while my platform gets the rest 50%. Then what happens? Would I need to use a webhook then to transfer 50%?

neon pivot
#

but hold on a second, let's say I only want to transfer 50% of the payment to the connect id while my platform gets the rest 50%. Then what happens? Would I need to use a webhook then to transfer 50%?

atomic yew
#

Wow, I wish I had asked you another time about that. The way I did it before was a lot more complex. Unless it had to be. For the other thing I was doing, I was transferring in a payment intent success webhook. I was calculating total amount of items in a cart.

#Need to convert to int twice because checkout metadata causes the original int to become a float
stripe.Transfer.create(amount=int(int(converted_total_price) * (settings.STRIPE_CONNECT_AFFILIATE_PERCENT / 100)),currency="usd",destination=affiliate_connected_account,)

#

Now I am worried that I was not getting a fee at all and I was in fact losing money with this method I was doing...

#

https://dpaste.org/UFLTu - this is what I had.. But oh wait a second, each course in the cart could be taught by a different teacher connect id which is why I may have done it this way. But I am still worried I am not getting a slice of the pie and I am just calculating the amount to be sent to the connect account

neon pivot
#

Can I check if it is one checkout session to 1 connected account or one checkout session to many connected account?

atomic yew
#

oh shoot ignore that one dpaste, i found the real one with the dictionary

neon pivot
#

Sorry what do you mean?

#

Could you explain both scenarios in an example?

atomic yew
#

Sure, one sec. Gotta type it out

#

So my site allows anyone to buy courses from one or more teacher connect ids. In a single checkout session they may buy 1 course tied to 1 teacher connect id. Or 1 teacher connect id can sell multiple courses and the customer buys all of them. Or a customer can buy multiple courses in their cart, each from multiple teacher connect ids.

#

So what I do is I make a dictionary of the course ids and their prices. If the customer uses multiple promo codes, I calculate the updated total prices for all the courses.

#

Then what I do is for each course, I transfer 50% to the teacher connect account for each course. Based on what you told me about configuring the fee, I have no clue now if I am not getting that money at all and it gets lost in the new calculated sum and transfer.

#

For example:

Course: Python
Teacher Connect ID: 1
Price: $2

Course: Django
Teacher Connect ID: 1
Price: $4

Course: HTML
Teacher Connect ID: 2
Price: $6

Course: CSS
Teacher Connect ID: 2
Price: $8

A customer could just buy Python in 1 cart checkout.
A customer could buy Python and Django in 1 cart checkout.
A customer could buy Python and HTML in 1 cart checkout.
etc.

settings.STRIPE_CONNECT_ORDER_PERCENT = 50% transfer amount

neon pivot
#

Just looking at your example now.

atomic yew
#

Then in the webhook for each course in the cart I transfer 50% of the course's price to the connect id:

transfer_amount = int((course_price * (settings.STRIPE_CONNECT_ORDER_PERCENT / 100)) * 100)
stripe.Transfer.create(
amount=transfer_amount,
currency="usd",
destination=teacher_connected_account,
description=f"Transfer for course {course_id} sale"
)

#

So if a customer buys Python and HTML:

Teacher Connect ID: 1
Gets $1 for Python

Teacher Connect ID: 2
Gets $3 for HTML

But what happens to the rest of it? Does the remaining $1 and $3 go to my platform?

#

Lines 18-36 in the latest dpaste is what I am doing only.

neon pivot
#

But what happens to the rest of it? Does the remaining $1 and $3 go to my platform?
With separate charges and transfers, your platform gets the funds that are not transferred to your connected accounts.

atomic yew
#

okay, and because I am not doing that, the funds are basically gone?

#

But isn't that what my code is already doing? How would I know if I am using separate or not?

neon pivot
#

okay, and because I am not doing that, the funds are basically gone?
No the funds are not gone. With Separate Charges and Transfers, the funds go to your platform's balance first and then the relevant amounts you determine will be transferred to the connected accounts.

atomic yew
#

okay good to know. Now how do I know if I am using separate or not? From the looks of that link, it looks like I am doing all of that right?

neon pivot
#

But isn't that what my code is already doing? How would I know if I am using separate or not?
Yes, basically you just need to create the checkout session, ensure you listen to the correct webhooks and then you can transfer the funds accordingly.

atomic yew
#

Good, is there a way on the dashboard to see this happen step by step? Where are my platform funds for example?

neon pivot
#

Your platform funds are just your Stripe account balance.

atomic yew
#

okay i will test real quick

limber umbraBOT
atomic yew
#

okay can you check if this is correct. I just did one for $1 course

#
covert wind
#

๐Ÿ‘‹ taking over here

#

Can you clarify is this what you expected?

atomic yew
#

hmm, I want 50 cents to go to that connect account ending in QL3t. But I also want to keep 50 cents or half.

covert wind
#

Sure. Did you call a Transfer API?

atomic yew
covert wind
#

Seeing that Transfer succeeded too

atomic yew
#

Cool! So I am good? That code properly uses separate charges and transfers?

covert wind
#

You need to listen to checkout.session.completed webhook event, call Retrieve Checkout Session API and expand payment_intent to get the charge value, which is the Charge Id, to specify here

#

(if you want to ultilize the Transfer Availability feature on above Doc)

atomic yew
#

hmm so all that does by setting source_transaction is it helps prevent your balance from going negative?

covert wind
#

Yep