#theo_checkout-connect
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/1219301800352419902
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
I can use Direct Charges to my connected Express accounts, but I would prefer to pay the stripe fees myself instead of my event organizers having to pay this fee
So, my main goals are as follows (in order of priority): 1. money should go directly to organizers (I do not want the money to get recorded as revenue to my platform, only my platform fee should be recorded) and 2. I would prefer to pay the Stripe Processing Fee from my application_fee_amount instead of my organizer paying the Stripe fee besides my application_fee.
Sorry for the wait @sleek hamlet ! Where are you seeing the "Unexpected error communicating with Stripe"? Is it something you see in the UI?
Also, do you have a Checkout Session ID we can take a look at?
theofenol_checkout
hey
1 sec, i ll show you
this should be the checkout page, displayed using redirectToCheckout
Do you have the Checkout Session ID?
"cs_test_b1PHdMwi1N8jpBHpdbo07FEt2KnBXlZ54C5oGh31kV0ggcdI0IBFo8sP4E"
Hmmm... Can you show me what your code for redirectToCheckout looks like (also I just want to note - we generally don't recommend using redirectToCheckout anymore and instead say you should redirect using the URL you get back from Checkout Session creation)
static Future<CheckoutResponse> _redirectToCheckout({
required String sessionId,
required String publishableKey,
String? stripeAccountId,
String? successUrl,
String? canceledUrl,
}) async {
final options = StripeServerCheckoutOptions(sessionId: sessionId);
final stripeOption = StripeOptions();
if (stripeAccountId != null) {
stripeOption.stripeAccount = stripeAccountId;
}
try {
final response = await Stripe(publishableKey, stripeOption)
.redirectToCheckout(options);
if (response != null && response.error != null) {
return CheckoutResponse.error(error: response.error);
} else {
return const CheckoutResponse.redirected();
}
} catch (e) {
return CheckoutResponse.error(error: e);
}
}
@JS('Stripe')
class Stripe {
external Stripe(String publicKey, [StripeOptions? options]);
external String get publicKey;
external redirectToCheckout(StripeServerCheckoutOptions checkoutOptions);
}
I m doing it in flutter btw
Flutter for web
I got some files from the mobile library
it s working fine without on_behalf_parameter
Did you pass in stripeAccountId when you were redirecting for cs_test_b1PHdMwi1N8jpBHpdbo07FEt2KnBXlZ54C5oGh31kV0ggcdI0IBFo8sP4E ?
I tried passing both mine (the platform) and the connected account id
I mean doing it both ways
both as direct charge and as destination charge
for me, the best would be destination charge, but done like a direct charge
You shouldn't be passing stripeAccoundId at all for destination charges
I know
Sorry let me back up - you mentioned you tried passing your (the platform) account ID. Did you do that for destination charges?
No, basically I meant I did the stripe call without adding {stripeAccountId: connectedAccountId} after the session JSON
a destination charge
like this
const session = await stripe.checkout.sessions.create({
line_items: req.line_items,
mode: "payment",
customer_email: req.customer_email,
success_url: myurl,
cancel_url: myurl,
payment_method_types: [
"card",
],
payment_intent_data: {
on_behalf_of: req.connectedAccountId,
application_fee_amount: req.finerFee,
},
expires_at: Math.round(expiration.getTime() / 1000) + 1800 // 30 minutes * 60 seconds, 30 mins is minimum - do not change
}
);
So, just to explain better what I need
I need the behavior of destination charge (where me, the platform, pays the stripe fee), but with the business of record to be the organizer (like in case of direct charges)
Yeah on_behalf_of is the correct way to do that
I'm just trying to figure out why the redirect isn't working
so, just to be clear, is this the correct shape of the payment_intent_data section of my session:
payment_intent_data: { on_behalf_of: myConnectedAccount, application_fee_amount: feeThatGoesToMyPlatform }
Yes, that would be correct
because if i run like this
it also complains about transfer_data[destination]
and then i did payment_intent_data: { on_behalf_of: myConnectedAccount, application_fee_amount: feeThatGoesToMyPlatform, transfer_data: { destination: myConnectedAccount} }
and I get the same issue with unexpected...
and if i set my platform account in destination, it says The 'payment_intent_data[transfer_data][destination]' param cannot be set to your own account.
Sorry I didn't mean to imply that would be the only things you need to set - if you're doing destiantion charges you have to set payment_intent_data.transfer_data.destination to the connected account. In addition to that, you can set payment_intent_data.transfer_data.on_behalf_of and payment_intent_data.applicatoin_fee_amount
Again, I'm still looking into why the unexpected error is hapepning - give me a bit to try and reproduce
No, the Checkout session ID is enough - I just need time to see if it's something I can reproduce as well
oh
ffs
I think i know what ahppens
the issue is with the redirectToCheckout
if I just simply copy paste the url and put it in a browser, it works fine
now i am wondering why without on_behalf_of is working ๐ค
Yeah as I mentioned earlier we dont' really recommend redirectToCheckout anymore
(but as far as I know what you're dong should still work, so I'm having a teammate test it out on our end)
And if I am not using the redirectToCheckout, just simply using some url package to redirect my user to the CO session url
will the succes/cancel url redirects still work???
I guess they will, right?
Yes, the success/cancel redirects would still work
@buoyant bloom the links seem to be different
this is the link which redirctToCheckout redirects me using sessionId
and this is the url attached to the same session object
and the second one works
I believe it's expected that those would be different (redirectToCheckout is implemented in a different way) but let me look at your new example and see if I'm missing anything
Can you try going through the flow again, and this time log the sessionId, stripeAccountId, and publishableKey (jsut the last 4 digits) that you sent redirectToCheckout?
sure
btw... this is adding the full amount to my gross volue
not just the application fee ๐ฆ
yeah let's put that aside for now and just sort out why the redirection isn't working as expected first
sessionId
"cs_test_a1wohD2HkbrSYZZTm41rN6Oaa4qtfpqH5lhTP7AXYdfXJ8YDv9wqUWfAYg"
pk_test_...........H7qL
H7qL are the last 4
acct_1NnS7QBwzYCsCn82
Gotcha - so right now you are passing in a stripeAccountId, right?
yes
my platform accountid
and the checkout session is created on my server side using the SK of my platforjm
Cool - so can you try one more time and don't pass in the stripeAccountId at all?
const stripe = require("stripe")(myPlatformSK);
sheesh
it s working
๐
thanks
hurray!
sure! ca you summarize what the gross volume issue was?
So
take a look at this payment
So, I want my gross volume to record just the application_fee_amount
the gross volume of the platform
If one of my event organizers sells a ticket for 100 euros let s say
my platform fee is 6% = 6 euros
I want 100 euros to appear on my organizers record (the connected account)
and only 6 euros to appear on my record (me being the platfor)
and out of these 6 euros I will also pay the Stripe fees
So 106: 100 directly to my connected account, 6 to me and out of these 6 I pay stripe fee
I do not want to get the full 106 recorded to my gross volume because this will cause a huge revenue for my company and i will have to pay lots of taxes for nothing
because in the end i only keep 6%
I said earlier that my use case is more or less like a combination of direct and destination...
Yeah I think I understand what you're saying - let me see if there's a way to do this
Unfortunately I can't think of a way to do this with destination charges - with destination the funds are landing on the platform first, and I assume that means they're counted towards the gross volume of the platform
And then maybe some way to do it the other way around?
with direct charges?
but pay the Stripe fee out of the application_fee_amount...?
theo_checkout-connect
Direct Charges should only be used with Standard accounts though
here is a payment from yesterday
with direct charge
ideally for me would be to get the stripe fee 4.45 out of the 6.00 application fee
if possible ๐
It's not really how our products works so no that's not possible. Usually you pick an account type first (Custom, Express, Standard). Once you have that, you pick a flow of funds compatible with it and that dictates who pays what fees.
If you use Standard accounts and Direct Charges then the connected account always pays the Stripe fee, and you as the platform tack on your own fee