#amix_best-practices
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/1476658842090606854
๐ 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.
- amix_best-practices, 2 days ago, 35 messages
hello! you too ๐ have you looked at our accounts V2 API yet?
https://docs.stripe.com/connect/accounts-v2
the short version (to a longer story) is that you need to have them set up as a V2 account, and then from there you need to pass in customer_account and.... some other parameter i am struggling to find right now
let me look up my test script for this
"payment_method_types": ["stripe_balance"],
actually sorry i missed a step - honestly our guides on this aren't amazing on this yet
https://docs.stripe.com/connect/use-accounts-as-customers
this guide has some basic examples of how to handle this with subscriptions, but not really anything for PaymentIntents, so let me put together a really simple example for you
FYI it's taking me a bit of time to test and ensure my example is in a sharable state
this example is in python but i think it's pretty straightforward, feel free to let me know if you have any questions!
# this example assumes you have the account ID ready to go.
# create a payment intent and bypass pending to ensure the connected account has funds
direct_payment_intent = client.v1.payment_intents.create({
"amount": 1000,
"currency": "usd",
"off_session": True,
"confirm": True,
"payment_method": "pm_card_bypassPending",
}, options={
"stripe_account": account.id,
})
print(direct_payment_intent.id)
# loop until the balance is available
balance_available = False
while not balance_available:
balance = client.v1.balance.retrieve(
options={
"stripe_account": account.id,
}
)
print(balance.available[0].amount)
if balance.available[0].amount > 0:
balance_available = True
time.sleep(1)
# create a setup intent to give the stripe account a payment method you can use later
setup_intent = client.v1.setup_intents.create(
params={
"customer_account": account.id,
"payment_method_types": ["stripe_balance"],
"confirm": True,
"usage": "off_session",
"payment_method_data": {"type": "stripe_balance"},
}
)
print(setup_intent.id)
# charge your stripe account using their stripe balance
direct_payment_intent = client.v1.payment_intents.create({
"amount": 100,
"currency": "usd",
"off_session": True,
"confirm": True,
"payment_method_types": ["stripe_balance"],
"payment_method": setup_intent.payment_method,
"customer_account": account.id,
})
print(direct_payment_intent.id)```
That's very kind of you, thanks !
I am good with this, have a wonderful rest of your day ๐