#some1ataplace_api
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/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.
- some1ataplace_best-practices, 8 hours ago, 30 messages
- some1ataplace_best-practices, 22 hours ago, 50 messages
In terms of tipping the connect id, anybody could tip them one time, daily, monthly, yearly, weekly, etc.
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?
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
This is an example of donating to my website and not the connect id. https://dpaste.org/bobOP
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
What type connected account are you using? Standard, Express, Custom or are you using the controller configuration (https://docs.stripe.com/api/accounts/create#create_account-controller) ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
Yes you are right! This document shows you how to do it: https://docs.stripe.com/connect/destination-charges?platform=web&ui=stripe-hosted#create-checkout-session
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?
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.
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%?
how would i configure the checkout to handle subscription payments to that connect id?
- You will need to change the mode to subscription. (https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-mode)
- You will need to set the connected accoutn ID via subscription_data: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-transfer_data-destination
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%?
- For one time payment you will need to calculate the application fee such that it's 50% of the charge
- For subscription, you cna set either
subscription_data.application_fee_percent(https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-application_fee_percent) orsubscription_data.transfer_data.amount_percent(https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-transfer_data-amount_percent)
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
Can I check if it is one checkout session to 1 connected account or one checkout session to many connected account?
it can be both scenarios. I would have to modify the webhooks a bit and show you and run it a few times. Otherwise, here is my past data from a few months ago in test mode:
https://dashboard.stripe.com/test/connect/accounts/acct_1PrZiiIyAOR1QL3t/activity?backTo=list.{}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
oh shoot ignore that one dpaste, i found the real one with the dictionary
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
Just looking at your example now.
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.
In this case, you should use separate charges and transfers instead: https://docs.stripe.com/connect/separate-charges-and-transfers?platform=web&ui=stripe-hosted#create-checkout-session
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.
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?
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.
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?
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.
Good, is there a way on the dashboard to see this happen step by step? Where are my platform funds for example?
When you create a checkout session and there is a successful (or unsuccessful) charge, you can see it in the dahsboard here: https://dashboard.stripe.com/test/payments
Your platform funds are just your Stripe account balance.
okay i will test real quick
okay can you check if this is correct. I just did one for $1 course
https://dashboard.stripe.com/test/connect/accounts/acct_1PrZiiIyAOR1QL3t/activity?backTo=list.{}
https://dashboard.stripe.com/test/payments/pi_3QPdUGIeTJrsS1re0ky3Zo1w
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
๐ taking over here
This is your request creating the CheckoutSession: https://dashboard.stripe.com/test/logs/req_nyDPVugjQlLKke
As you didn't setup application_fee, all of this $1 USD went to your Platform account
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you clarify is this what you expected?
hmm, I want 50 cents to go to that connect account ending in QL3t. But I also want to keep 50 cents or half.
Sure. Did you call a Transfer API?
Okie seem to be https://dashboard.stripe.com/test/logs/req_WnbK9vxdTroolW
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Seeing that Transfer succeeded too
Cool! So I am good? That code properly uses separate charges and transfers?
Yes, but there is Transfer availability too (see https://docs.stripe.com/connect/separate-charges-and-transfers?platform=web&ui=stripe-hosted#transfer-availability) which you can improve by specifying the source_transaction on your Transfer API
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)
hmm so all that does by setting source_transaction is it helps prevent your balance from going negative?
Yep