#Kolombina-setup-intent

1 messages · Page 1 of 1 (latest)

plain crescent
#

That is the guide for using a SetupIntent to collect card details with Elements

astral shore
#

and if we want to use CcheckoutSession it means that we have to create card -> Source -> assign the Source to Customer? what then&

plain crescent
#

Nope, if you use Checkout then it will handle all of this for you.

#

You just create the Checkout Session in setup mode and a customer will be created and card will be attached to that customer upon completion of the Session.

astral shore
#

ok, thanks. Next question:
We want to implement Direct Payment to connected accounts created on ours platform. So as I understand and checked: creating cutomer on Connected_account X doesn't allow to use the same 'source' to pay to Connected_account Y?

#

Is it correct?

plain crescent
#

That's correct. You would want to clone PaymentMethods in this case

#

You would tokenize on your Platform and clone to each Connected Account

astral shore
#

so we've chosen the following way:

  1. create a customer on platforn_account
  2. create a source and link it with the customer
  3. Clone source and customers to the another connected account.
plain crescent
#

When you say "source" are you talking about our legacy Sources API?

#

If so, you should use our new(er) PaymentMethods API instead.

astral shore
plain crescent
#

If you are using Checkout then it will create the PaymentMethod automatically.

#

Checkout does not use Sources.

astral shore
#

this error I get after using stripe.checkout.Session for customer created at dashboard by hand and created paymntMethods
You provided a customer without specifying a source. The default source of the customer is a source and cannot be shared from existing customers.

#

session = stripe.checkout.Session.create(
customer=customer,
payment_method_types=['card'],
mode='payment',
line_items=[{
'name': payment_name,
'amount': data_in['price'],
'currency': 'pln',
'quantity': data_in['quantity'],
}],
payment_intent_data={
'application_fee_amount': fee,
'setup_future_usage': 'off_session'
},
success_url=f"{settings.FRONTEND_DEV_APP_URL}/{line}",
cancel_url=f"{settings.FRONTEND_DEV_APP_URL}/{line}",
stripe_account=connected_account_id,
)

plain crescent
#

I think you are a bit confused... if you use Stripe Checkout you don't create the Customer and PaymentMethod via the Dashboard.

#

So for the code above, you are creating the Checkout Session on your Connected Account

astral shore
#

may by (then sorry). but i've created a Customer and PaymentMethod and used their id

plain crescent
#

Let's back up a second.

#

At the beginning you stated you want to collect card details first, then charge them.

#

However, the Checkout Session you created above is in "payment" mode. Which means you are charging the Customer via the Checkout Session.

astral shore
#

yeap 😅 it's kind of thinking for future:
if I collect card data by Checkout Session it means that I'l not be able to use the customer's card the next times (because I'l create a stripe custoner linked with specificconnected_account)

#

this is problem

plain crescent
#

Right so to solve that, you create the Checkout Session on your Platform and collect the card details there.

#

Then in the future you can clone the PaymentMethod to your Connected Accounts to use with as many accounts as you want!

astral shore
#

oh. now I understand. Thanks for patience!

plain crescent
#

No problem at all!