#carlos-fontana_code

1 messages · Page 1 of 1 (latest)

gusty drumBOT
#

👋 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/1331984769004863600

📝 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.

fading ginkgo
#

Hello, I would like to share the relevant part of our code with you so you can review it and confirm if we are following best practices. Specifically, we want to verify that:

1.    The Destination Charges are set up correctly.
2.    Metadata and customer details are being appropriately passed and updated in the related objects.
3.    The workflow adheres to Stripe’s requirements for handling charges and transfers in a Connected Account setup.
slow bolt
#

Hey
Sorry but we don't provide code reviews here, but happy to discuss with you the concepts

#

And how to use Stripe APIs.

fading ginkgo
#

I’ve tried to simplify my code as much as possible

#

Ah ok

#

Cool, I'll create a summary, give me a few mins

slow bolt
#

Usually you should ask your self couple of questions in order to determine what type of Connected Account and Charges

gusty drumBOT
slow bolt
#

The main question here, who will be managing the funds (for example who will be responsible for refunds and disputes) is it you (the platform) or your Connected Accounts ?

fading ginkgo
#

The connected accounts

slow bolt
#

In that case you should use Standard Connect Accounts with Direct CHarges

fading ginkgo
#

Ok

#

Got it, .... on my code, I currently do this

Creating a Payment Intent:
• I either retrieve or create a customer using their email address.
• I set metadata with detailed information about the donation (event, donor details, fees, etc.).
• I configure: application_fee_amount for the platform fee; transfer_data.destination to send the remaining funds to the connected account and on_behalf_of to indicate the connected account for the Payment Intent.

neon condor
#

Do you have a specific example you can share?

fading ginkgo
#

Like, ids ?

neon condor
#

But sounds like right now you're doing destination charges, which means refund/dispute liability will on the platform

fading ginkgo
#

Ok one sec

neon condor
#

Yep, pi_3Qk7JCEsYIHxK4oE0kaGA2lU is a destination charge

fading ginkgo
#

Ok, so, I'm implementing destination charges and not direct charges

#

Right?

neon condor
#

Yes as it is right now

fading ginkgo
#

Got it

#

I'm reading the "direct charges" documentation, but I'm not sure if I should start from scratch or not

#

Could you give me some guidelines of what is the main difference in the implementation? I understand the main idea, but I'm not sure what to change

neon condor
#

You're using standard accounts so should be doing direct charges really

neon condor
#

But important you understand differences in liability and flow funds etc

fading ginkgo
#

Ok

#

This is the code where I'm creating the Payment Intent

const params: PaymentParams = {
  payment_method: paymentMethodId,
  currency,
  amount,
}
...

const customers = await stripeClient.customers.list({ email })
const metadata = {...}

...

const merchant = await this.merchantInteractor.getMerchantByEventId(
  eventId
)

params.application_fee_amount = Math.ceil(trx.total - trx.donation)
params.transfer_data = {
  destination: merchant.stripeAccountId,
}
params.on_behalf_of = merchant.stripeAccountId
...

const paymentIntent = await stripeClient.paymentIntents.create({
  ...params,
  description,
  metadata,
})
neon condor
fading ginkgo
#

Ok, makes sense! thanks!