#ed_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/1275929621153714319
๐ 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.
- ed_connect-fees, 2 hours ago, 9 messages
From stripe customer.Create docs: "When using payment sources created via the Token or Sources APIs, passing source will create a new source object, make it the new customer default source, and delete the old customer default if one exists.
This sounds even worse actually!! It will delete the old customer from my connected accounts (removing them from previous charges) and create brand new customers, which aren't assigned to previous charges??
That's a legacy feature, you should be looking at cloning the Payment Method instead: https://docs.stripe.com/payments/payment-methods/connect#cloning-payment-methods
Oh hmm... I am creating an embedded checkout session:
session = stripe.checkout.Session.create(
# customer=request.user.stripe_customer_id if request.user and request.user.stripe_customer_id else None,
line_items=stripe_line_items,
stripe_account=stripe_account.id,
payment_intent_data={
"application_fee_amount": stripe_account.calculate_application_fee(amount=total_amount),
"metadata": stripe_payment_generate_metadata(
stripe_payments=[o.stripe_payment for o in objects_with_stripe_payments]
),
},
ui_mode="embedded",
mode="payment",
return_url=return_url,
expires_at=int((datetime.datetime.now() + datetime.timedelta(minutes=30)).timestamp()),
)
And I'm trying to pass the customer in.
That has nothing to do with cloning Payment Methods though?
Right, it has nothing to do with cloning payment methods. When I pass a platform customer into checkout.session.create, it will error that the customer does not exist. I assumed it's because the connected account has no access to platform customers?
Or am I getting something very wrong?
Yeah, if you're cloning Payment Methods and Customers to the Connect Account, then you wouldn't use Checkout. You'd just create a Payment Intent instead and capture it with the Payment Method.
You technically can clone the Payment Method and Customer to the Connect Account to make it accessible on that Connect Account for Checkout, but at that point you may as well just create the payment with a Payment Intent or skip cloning altogether and create a new Customer on that Connect Account with Checkout.
Hmm... I'm still really confused. I want to use checkout, but for each user on my platform, I only store the platform's stripe customer id.
So what process should I follow when creating the checkout session for the connected account? How can I pass the customer in?
I guess I can create a new customer, but then for repeat purchases by users, I will be polluting my connected account's customer database, no?
How do people typically handle this - the platform stores a table of platform_customer_id, connected_account_id, connected_account_customer_id? ๐ค
Not if you reuse the Customer on their account.
That's one way to do it, yeah. And a very common one.
If you're creating Checkout Sessions directly on the Connect Account, then you should be creating Customer on that account too. You can listen for webhooks related to them and store all the Customer and Payment Method info that you need in your own DB for quick lookup