#_kevinx

1 messages · Page 1 of 1 (latest)

lavish nicheBOT
pastel axle
#

Hello! What's your question?

signal fossil
#

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

pastel axle
#

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

signal fossil
#

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

pastel axle
#

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?

signal fossil
#

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

pastel axle
#

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?

signal fossil
#

ok, here is what we are doing

  1. whenever a new user signs up, we create a stripe customer and using this customer id for all future checkout sessions
  2. 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

  1. Collect and attach the payment method at platform level
  2. 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

pastel axle
#

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?

signal fossil
#

we are using checkout pages, but please advice how to use payment intents instead

pastel axle
signal fossil
#

for connect standard account?

pastel axle
#

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

signal fossil
#

ok, what if the customer didn't have payment method saved and go straight to the checkout

pastel axle
#

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)

signal fossil
#

got you, the question is how to "pass in" saved payment method

#

the other guy told me to clone it

pastel axle
#

oops there's a typo - it should say "you can't"

#

the only use saved payment methods would have during checkout is for prefilling

signal fossil
#

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

pastel axle
#

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

signal fossil
#

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

pastel axle
#

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

signal fossil
#

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

pastel axle
#

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)

signal fossil
#

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?

pastel axle
#

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

signal fossil
#
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.

pastel axle
#

Is there a specific question you had about it?

signal fossil
#

yeah, I didn't see where application_fee_amount, line_items etc in the payment intent

pastel axle
signal fossil
#

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

pastel axle
#

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

signal fossil
#

sure, totally understand

pastel axle
#

With standalone payment intents there's no user interface so the customer isn't really even "seeing" anything

signal fossil
#

so it is an automatic underwater charge

#

at least the customer should see a question to authorize it?

pastel axle
#

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

signal fossil
#

this is not for subscription btw, it's like a retail

pastel axle
#

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)

signal fossil
#

Got you, thanks