#bmbrina_code

1 messages ยท Page 1 of 1 (latest)

sonic ferryBOT
#

๐Ÿ‘‹ 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/1343989816831770644

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

fathom folio
#

I got told by my Stripe rep to try the charge_id associated with the dispute but that's not working

indigo junco
#

Hi! Can you paste me that Request ID please?

fathom folio
#

For the py_XXXXXXX I mentioned, I found it under Transfer > Destination

indigo junco
#

That charge is on the Platform, not the Connected Account - so you don't need the Stripe Account header to retrieve it.

fathom folio
#

Do you mean on the stripeConnectInstance?

#

When creating the account session?

indigo junco
#

Can you share the code you used to make that request?

fathom folio
#

This is in the client

const [stripeConnectInstance] = useState(() => {
    const fetchClientSecret = async (): Promise<string> => {
      const res = await createAccountSession({
        variables: {
          data: {
            stripeAccountId: currentClinic?.submerchantStripeId || '',
          },
        },
      });

      return res.data?.stripeCreateAccountSession?.clientSecret || '';
    };

    return loadConnectAndInitialize({
      // This is your test publishable API key.
      publishableKey: env.REACT_APP_STRIPE_API_KEY,
      fetchClientSecret: fetchClientSecret,
      appearance: {
        overlays: 'drawer',
        variables: {
          colorPrimary: '#4F830F',
          colorText: '#000000',
          buttonSecondaryColorBackground: '#F5F5F5',
          buttonSecondaryColorBorder: '#F5F5F5',
          buttonSecondaryColorText: '#000000',
          colorSecondaryText: '#706E6C',
          actionPrimaryColorText: '#497CC3',
          colorDanger: '#CA4038',
          badgeNeutralColorBackground: '#EDEBEB',
          badgeNeutralColorBorder: '#EDEBEB',
          badgeNeutralColorText: '#000000',
          badgeSuccessColorBackground: '#E5F9C6',
          badgeSuccessColorBorder: '#E5F9C6',
          badgeSuccessColorText: '#3E660C',
          badgeWarningColorBackground: '#FFF6D7',
          badgeWarningColorBorder: '#FFF6D7',
          badgeWarningColorText: '#DF9F23',
          badgeDangerColorBackground: '#FFDFE6',
          badgeDangerColorBorder: '#FFDFE6',
          badgeDangerColorText: '#CA4038',
          offsetBackgroundColor: '#F5F5F5',
          borderRadius: '12px',
          buttonBorderRadius: '8px',
          formBorderRadius: '16px',
          badgeBorderRadius: '8px',
          //overlayBackdropColor: '#F5F5F5',
          spacingUnit: '8px',
        },
      },
    });
  });
#

This is in the server -- the stripeAccountId I'm passing is the one from our client's account

const STRIPE_API = 'https://api.stripe.com/v1';
const HEADERS = {
  Authorization: `Bearer ${process.env.STRIPE_SECRET_KEY}`,
  'Content-Type': 'application/x-www-form-urlencoded',
};

const response = await fetch(`${STRIPE_API}/account_sessions`, {
  method: 'POST',
  headers: HEADERS,
  body: new URLSearchParams({
    account: stripeAccountId,
    'components[payment_details][enabled]': 'true',
    'components[payment_details][features][dispute_management]': 'true',
    'components[payment_details][features][destination_on_behalf_of_charge_management]':
      'true',
  }),
});
indigo junco
#

Why are you not using Stripe's Node.js library for this?

#

You're 'not doing this client side, are you?

fathom folio
#

Looong story but we are using a really old version of the SDK and it doesn't include the functionality to create an account session and since it's "urgent" that we get this out I can't update the package as part of this release without needing to regression test a bunch of things

#

Nope, it's on our BE service

indigo junco
#

:PHEW:

#

Sadly you wouldn't have been the first to try that. ๐Ÿ˜ญ

fathom folio
#

lol

#

I'm getting the client secret just fine, but I'm curious now if I should be sending the client account or our own account id

indigo junco
#

Retrieving a charge requires none of that - it's the code that is running this request that you need to change: GET /v1/charges/ch_3Quhg6GF9ZPA9WP51xXVf4rR

#

It's currently trying to retrieve a Charge from a Connected Account, but that Charge is on your Platform.

fathom folio
#

But doesn't that request comes from inside the Connect component? ๐Ÿค”

indigo junco
#

Yes.

#

But the Charge is not in the 'Connect component'

#

One-offs work just fine, but Subscriptions are not working, right?

#

Hold on

fathom folio
#

Yeah, that's correct

One-offs work if I provide the py_XXXXXX

indigo junco
#

What arre you trying to do here exactly?

fathom folio
#

๐Ÿ˜‚

indigo junco
#

There are multiple unrelated API calls/information in the conversation, so I just want to be sure I understand.

fathom folio
#

I was rendering the payments component that lists all payments to see which id's it uses so that I could try to find them and one-offs are working fine if I provide py_XXXXX but even inside that component the subscription ones are not working

#

Example failed requests from the payments component
req_bytxVvfpvJZiXw
req_mZwFmmLgfBtPLp

#

It's listing the dispute as connected to the client's account but when trying to open it, it fails

indigo junco
#

When you say "It", what is "It"?

fathom folio
#

The Stripe component

fathom folio
#

Did I choose the wrong category? It's my first time asking here ๐Ÿ˜…

indigo junco
#

No, I took a few years off and they made a lot of new things since I left so I was confused - sorry about that!

fathom folio
#

No worries! I'm getting more info on how we handle our subscriptions. I think the issue might be that we collect the payments on our account and then we do the transfer to the client's account but we're not linking that transfer to the original payment. We have a transfer_group associated with the payment on our side but that's about it.

But it's lunch hour so I stopped getting answers from my team for the time being lol

sonic ferryBOT
azure rover
#

hi! fyi i'm taking over this thread. catching up on things now

fathom folio
#

Thanks!

sonic ferryBOT
azure rover
#

ok, i think i'm caught up on the core of your question. basically it sounds like you're trying to implement the payment details embedded component but you're still struggling to find the right charge ID to use? and if you try to do a GET on one of the charge IDs you think might be the right one to use you're getting a 404?

#

can you sanity check that for me?

#

also it sounds like you're looking into this for a particular subscription right? can you share that subscription ID?

fathom folio
#

Yeah, that's basically it.

I have to different use cases under a given account:

  1. One-off payments -- I was able to figure this one out by playing around with the payments component (use the py_XXXX associated with the transfer) just want to confirm this is the correct way to do it for this case
  2. For subscriptions -- I was told by my Stripe rep to look at the dispute > payment intent > charge id but this is the one that's not working, more than likely because it's associated to our account instead of the connected account but I'm unsure how to track down the charge_id of the connected account or if we need to make changes on our side for this

Here's a sample subscription + a sample dispute invoice
Subscription ID: sub_1Quhg6GF9ZPA9WP5aca3us8x
Invoice ID: pi_3QugXzGF9ZPA9WP50s1KwqfM

azure rover
#

hmmmmmm. the dispute part is throwing me off a little bit. normally if you were looking for the charge on the latest invoice you could just get the subscription.latest_invoice.payment_intent and that would get you the latest_charge

#

but it does look like that charge lines up with the one you were trying to GET earlier: ch_3Quhg6GF9ZPA9WP51xXVf4rR

fathom folio
#

Yeah and that's the one that's failing. What's weird to me is that it's being displayed in the list of disputes for the account but it fails to retrieve the charge ๐Ÿค”

So if it wasn't linked on our side, it wouldn't even show up there I think?

#

Hopefully this is somewhat legible -- it's the email I got from the Stripe rep

azure rover
#

ok, so yeah i'm seeing that the charge ID looks like it's tied to your platform account, but you're making the request to your connected account using the Stripe-Account. so i think that's the core of the issue. you said you were using transfers to get the funds to the connected account?

#

if so i think your solution is to use the payment ID associated with the transfer

#

ok yes i see further up you're just doing a transfer later on down the line after the charge completes

fathom folio
#

Ok, let me try that and I'll holler if I run into any issues

#

Thanks for the help!

azure rover
#

yep! if that doesn't work can you share the transfer ID and i can dig in from there?

#

i have to admit i am not super familiar with this embedded component so i'm operating from a perspective of how this should work. it makes sense that it wouldn't work for a charge connected with your platform account, so really we're just trying to find the payment associated with the transfer to the connected account.

fathom folio
#

I'm like 99% sure it'll work, I just did a quick test in Postman and was able to get the list of transfers associated with the transfer_group and I can just grab the latest_charge_id from the invoice to find the correct transfer and get the payment id

#

What a mouthful lol

#

But this is exactly what I need, much appreciated! I've been trying to find these id's for the last 2-3 days ๐Ÿ˜‚

azure rover
#

hahahaha no worries! happy to help

#

navigating all of the related objects in stripe can be fun