#bmbrina_code
1 messages ยท Page 1 of 1 (latest)
๐ 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.
I got told by my Stripe rep to try the charge_id associated with the dispute but that's not working
Hi! Can you paste me that Request ID please?
For the py_XXXXXXX I mentioned, I found it under Transfer > Destination
Yes
"https://dashboard.stripe.com/acct_1K1GR34hw4XLOVqF/test/logs/req_yCkUi0MxuKLyP2?t=1740498481",
ID: req_yCkUi0MxuKLyP2
That charge is on the Platform, not the Connected Account - so you don't need the Stripe Account header to retrieve it.
Can you share the code you used to make that request?
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',
}),
});
Why are you not using Stripe's Node.js library for this?
You're 'not doing this client side, are you?
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
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
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.
But doesn't that request comes from inside the Connect component? ๐ค
Yes.
But the Charge is not in the 'Connect component'
One-offs work just fine, but Subscriptions are not working, right?
Hold on
Yeah, that's correct
One-offs work if I provide the py_XXXXXX
What arre you trying to do here exactly?
๐
There are multiple unrelated API calls/information in the conversation, so I just want to be sure I understand.
So we're trying to render the payment details Connect component in our payment report -- https://docs.stripe.com/connect/supported-embedded-components/payment-details -- so that our clients can manage their disputes themselves
We have two type of disputes that could happen -- one-offs and subscriptions
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
When you say "It", what is "It"?
The Stripe component
The one from the screenshot is this one -- https://docs.stripe.com/connect/supported-embedded-components/payments
Did I choose the wrong category? It's my first time asking here ๐
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!
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
hi! fyi i'm taking over this thread. catching up on things now
Thanks!
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?
Yeah, that's basically it.
I have to different use cases under a given account:
- 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
- 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
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
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
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
what if you do https://docs.stripe.com/api/transfers/list and pass in the transfer_group param, then pass in the py_xxxx associated with that?
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.
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 ๐