#_kevinx
1 messages · Page 1 of 1 (latest)
Hello! What's your question?
Hello Karbi, so we are setup a checkout session to collect payment method by using the code above. and will need to clone the payment method when the customer doing Connect account purchases with this code below:
const paymentMethod = await stripe.paymentMethods.create({
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
}, {
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
});
the question is where to find payment_method_ID and how to use this const paymentMethod in the new Connect account checkout session
If you have an already successful setup-mode Checkout Session, you should be able to re-retrieve it and expand setup_intent and find the Payment Method nested there
ok, will check it out
how to use this clone in the new connect checkout session though
there is no attribute in the checkout session where we can plug it in
Let's back up for a minute - immediatetely after setup are you attempting to collect payment through a checkout session, but for the connected account?
no, I had a long converation with someone else in your team, he told me that the clone can only happen one direction from platform to connect
so we are setup the payment method at platform level, then clone it each time the customer make a connect account purchase
without creating a new customer
Gotcha - why do you need the new connect checkout session though? Do you want your customers to have to come back on-session to pay every time?
ok, here is what we are doing
- whenever a new user signs up, we create a stripe customer and using this customer id for all future checkout sessions
- but this doesn't work if the customer makes connect account purchase, and create a connect account checkout session
so the solution we got after today's discussion is
- Collect and attach the payment method at platform level
- Clone this payment method each time the customer makes connected account purchase
Our goal is to manage customers who can make both platform purchase and connect account purchase, but obviously Stripe needs different customer id for these two different context
Just to be super clear - is your plan to create a Checkout Session for every purchase? You don't plan on just using standalone payment intents at all?
we are using checkout pages, but please advice how to use payment intents instead
You can read more in this section of our docs (https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#charge-saved-payment-method) - we talk about how you can use an already saved payment method to create a payment intent and attempt to charge a customer off-session
for connect standard account?
Yeah it's the same general idea, you'll just need to make sure you're using the Stripe-Account header to create the Payment Intent on the correct Stripe Account
ok, what if the customer didn't have payment method saved and go straight to the checkout
That's fine too
just to clarify - you're still welcome to keep using Checkout Sessions for every payment, but if you do that your customer will still need to come back to Checkout to complete the payment. You can't just "pass in" saved paymetn methods to be used automatically for payment
Checkout will sometimes prefill a saved payment method under certain circumstances, but this doesn't happen all the time (example: we don't prefill the saved PM if the original card was from apple pay)
got you, the question is how to "pass in" saved payment method
the other guy told me to clone it
oops there's a typo - it should say "you can't"
the only use saved payment methods would have during checkout is for prefilling
ok prefilling is the least concerns here for us, we want to give the customer one stop where they can access all the payment history
as well as update their payment method
so to avoid creating a new customer each time they make a purchase
we are trying to leverage the same stripe customer id
created when they sign up
we want to give the customer one stop where they can access all the payment history
The only thing we have that comes close if the customer portal (https://stripe.com/docs/customer-management) but it'll show payments that were made through Invoices, not a full payment history
that's what we are trying to use, it takes in one customer id
oh, hold on, invoices
where can the customer get their receipts then
There isn't a single portal or anything we provide where a customer can download their receipts - most people take advantage of the accuont setting we ahve to email receipts when payment is complete instead
Or you'd have to build it yourself
really? I saw OpenAI offer receipts download and looks that's from Stripe
but thanks for the info, if Stripe sends out receipts, that's totally fine
Yeah I don't know what OpenAI is doing specifically - but it's very possible they're leveraging subscriptions which are built on top of invoices (which would show up with the customer portal)
ok, so Stripe sends out receipts, that's great, we can skip the receipts part on our end.
then regarding how to use the saved payment method for all future purchase, your recommendation is to leverage the payment intents right?
It's really up to you - if you're fine with your customers coming back on session for every payment then Checkout Sessions work great. But if you want to automatically charge your customers off-session with a saved paymetn method then you're better off using Payment Intents directly or Invoices
const session = await stripe.checkout.sessions.create(
{
mode: "payment",
client_reference_id: renteremail,
line_items: [
{
price_data: {
currency: "usd",
unit_amount: 22,
},
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: 11,
setup_future_usage: "off_session",
},
customer: stripecusid,
success_url: `${req.headers.origin}/account`,
cancel_url: `${req.headers.origin}/?canceled=true`,
},
{
stripeAccount: stripeAccountID.stripeid,
}
);
for connected standard account, this is the session we use,
it involves application_fee_amount, line_items etc.
Is there a specific question you had about it?
yeah, I didn't see where application_fee_amount, line_items etc in the payment intent
line_items are not somethign you can set in payment intent, but application_fee_amount is right here https://stripe.com/docs/api/payment_intents/create#create_payment_intent-application_fee_amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, we have to use checkout session then
what I don't understand is why Stripe doesn't use the same customer id for both platform and connect account, even though it is the same single obj in real life
btw, what happens if we use payment intent instead of checkout session, what does the customer see differently
I'm sorry, but it's just not somethign we support right now - I can understand why you want that functionality but there's a lot of technical implications here and it's not somethign we can build out
Really I would try all this out yourself in test mode so you can get a sense of how using standalone payment intents work
sure, totally understand
With standalone payment intents there's no user interface so the customer isn't really even "seeing" anything
so it is an automatic underwater charge
at least the customer should see a question to authorize it?
This is why I mentioned this is all up to you - some integrations (imagine a recurring subscription) don't want their users to authorize every payment so they charge the payment method off-session
this is not for subscription btw, it's like a retail
If you have an integration that needs payment authorization each time then you can build that
Either with Checkout, or with Payment Intents (both would work for what you need)
Got you, thanks