#Andrew-Connect

1 messages · Page 1 of 1 (latest)

dark cypress
#

Hi there! That looks like the Express Dashboard, correct?

loud bay
#

yup

dark cypress
#

Are you creating Direct Charges on the Connected Account?

loud bay
#

I'm creating charges like this:

const session = await stripe.checkout.sessions.create({
        line_items: enrollment.sessions.map(({ title, description }) => ({
          price_data: {
            currency: 'USD',
            product_data: {
              name: title,
              description: description,
            },
            unit_amount: enrollment.pricePerSession * 100,
            tax_behavior: 'inclusive',
          },
          quantity: 1,
        })),
        success_url: `${APP_URL}/enrollment/${enrollment.id}`,
        cancel_url: `${APP_URL}/enrollment/${enrollment.id}`,
        mode: 'payment',
        payment_intent_data: {
          application_fee_amount: Math.ceil(
            enrollment.pricePerSession *
              enrollment.sessions.length *
              FEE_PERCENTAGE,
          ),
          transfer_data: {
            destination: coach.coach?.stripeId,
          },
        },
        expand: ['payment_intent'],
      })
#

I think it's destination charge?

dark cypress
#

Yep looks to be. Okay good. Can you provide the payment ID from your Connected Account (py_xxxx) that is pending?

#

I assume this is due to the funds just not being available yet.

#

But I'm unfamiliar with us showing pending on that Dashboard UI (we just updated the Express Dashboard recently)

#

So would like to confirm that is the case

loud bay
#

Ah how do I get that?

dark cypress
#

Typing out how to access that, one sec...

#

So there are a couple ways to about this, but the best way for this scenario in my opinion will be to list transfers to the Connected Account in question using: https://stripe.com/docs/api/transfers/list#list_transfers-destination. When you list these transfers you can expand the destination payment: https://stripe.com/docs/api/transfers/object#transfer_object-destination_payment and also expand the balance_transaction: https://stripe.com/docs/api/charges/object#charge_object-balance_transaction.

#

On the balance transaction will be the status as referenced above

#

This will allow you to see all payments on that Connected Account that are pending

loud bay
#

hmm is there any way to get the balance transaction id from the checkout session or payment intent?

#

want to avoid an extra lookup if possible

dark cypress
#

You have to get to the Connected Account payment which you can't access directly from the Session or PaymentIntent unfortunately since you can't access the transfer directly from those objects.

loud bay
#

Gotcha, okay will give this a try, thank you!

dark cypress
#

Sure!

loud bay
#

actually one more question, how do I know which balance transaction relates to which checkout / payment intent?

dark cypress
#

Ah shoot actually I forgot

#

We do provide the transfer ID... it is just associated with the Charge, not the PaymentIntent.

#

Which you can access

#

So instead of listing transfers like I noted above you can go PaymentIntent --> Charge --> Transfer --> Payment --> Balance_transaction

loud bay
#

gotcha, I see the charge on paymentintent is a list, when would there be multiple charges for a single payment?

dark cypress
#

Only if there are failures

#

You basically just want the most recent charge for any successful paymentintent

loud bay
#

okay this helps a lot, thank you!