#brunoripa.

1 messages · Page 1 of 1 (latest)

rough valveBOT
#

Hello! We'll be with you shortly. 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.

tired sedge
#

Can you share the example Payment Intent (pi_xxx) or Checkout Session (cs_xxx) that has been completed?

buoyant heart
#

sure

#

cs_test_b1Q801mD4CLF1XiolKnqAZgzj8qRrcHl694PQft6sn1tUsM5wsZ32334g6

tired sedge
#

The Checkout Session was create directly on the account itself: https://dashboard.stripe.com/test/logs/req_VaoBA7VIJla2R5

However, your Webhook endpoint was set up to listen to Connect type of events: https://dashboard.stripe.com/test/webhooks/we_1OKcDnFgFaB0BYQrATjlYJLm

You should set up the Webhook endpoint to Account type to listen to the event on your own account: https://stripe.com/docs/webhooks#add-a-webhook-endpoint

Listen for events on your Stripe account so your integration can automatically trigger reactions.

buoyant heart
#

Fun yesterday I was suggested something different. Maybe because I explained that my platform sells on behalf of users ?

tired sedge
#

If the platform creates a Checkout Session on behalf of a connected account, then Connect type of Webhook endpoint should be used.

If the Checkout Session is created directly an account itself (not using platform API key), then Account type of Webhook endpont should be used.

#

Based on the cs_test_b1Q801mD4CLF1XiolKnqAZgzj8qRrcHl694PQft6sn1tUsM5wsZ32334g6, it was not created by the platform on behalf of the connected account

buoyant heart
#

I am creating either an account (for the seller) and a checkout session

#

what should be the right way to achieve what I am trying to do ?

#

selling on behalf of users and schedule payments to sellers (taking a fee)

rough valveBOT
buoyant heart
#

Oh I see, I am creating a checkour session which creates the account and the intent by itself

#

This is what I do to create the checkout session (in Elixir):

  def create_checkout_session(%User{} = user, intent_id) do
    line_items = prepare_line_items(user) |> IO.inspect(label: "Line items to be injected")

    Stripe.Checkout.Session.create(%{
      payment_method_types: ["card"],
      metadata: %{
        intent_id: intent_id
      },
      line_items: line_items,
      mode: "payment",
      success_url: System.get_env("URL"),
      cancel_url: System.get_env("URL"),
      payment_intent_data: %{
        metadata: %{
          db_intent_id: intent_id
        }
      }
    })
  end
pearl glade
#

in which case, setting up your webhook endpoint to listen to Connect type events is correct

buoyant heart
#

My design is that the platform gets the money, and it pays the sellers

#

Is still a valid scenario for what you are suggesting ?

pearl glade
#

maybe lets take a step back - who is the merchant of record for your business model i.e. will you (the platform) or the connected account appear on the customer's bank statement when they make payment?

buoyant heart
#

Yes, the platform will be the "official" seller - users will pay my platform

pearl glade
#

will you split the payment between multiple connected accounts, or the funds will only go to one single connected account?

buoyant heart
#

the user has a cart, where he can add items from multiple users. So, the single payment my platform receives will need to be splitted across multiple connected sellers accounts, sometimes

#

(after the fee is taken from the platform)

pearl glade
#

ah alright, then the way to go about it is to create the Checkout Session with your platform's secret key. The webhook should be created with account type

buoyant heart
#

so just create a session anytime a payment must occurr, right ?

#

if so, that's what I do

#

but one thing confuses me: if I create a session (and so a connected account) anytime a user wants to make a payment, from the point of view of the user wouldn't this split the transaction info of the user over multiple accounts or would this be transaprent to him ?

pearl glade
#

I'm not sure i understand the question here. When you create a Checkout Session, that's done on your platform account. So connected accounts have no visibility over the actual payment details (which is on your platform account). All they can see is what is on their connected account which is what you as the platform share (control) when transferring the funds to them

buoyant heart
#

Maybe I have a bit of confusion in mind. In order to execute a sale on behalf of that connected account, I have the responsibility to create the connected account (seller account), correct ? That's to be done only once, right ?

pearl glade
#

In order to execute a sale on behalf of that connected account, I have the responsibility to create the connected account (seller account), correct ? That's to be done only once, right ?

yep, that's correct. You only have to create the connected account once (if they don't currently exist)

rough valveBOT
buoyant heart
#

And when I do a sale, I have to listen for payment_intenent.succeeded, correct ?

turbid schooner
#

Hi! I'm taking over this thread.

#

are you using Checkout Session to accept payments?

buoyant heart
#

Yes

turbid schooner
#

then you should listen to checkout.session.completed

buoyant heart
#

Actually I create a stripe account for seller, and a checkout session when a purchase must happen

turbid schooner
buoyant heart
#

Ok, gotcha. But intermediate payment intent status would tell me details about purchase, right, as the session has no payment intent info unless it's completed

#

Correct ?

turbid schooner
#

if you want to know when a sale happened with Checkout Session, you should listen to checkout.session.completed