#Constant
1 messages ยท Page 1 of 1 (latest)
Thank you! I'll post the checkout code right now.
no need for code
would you mind sharing your account id, an event id or any request id so I could take a look
it's most probably a mis-configuration of the webhook endpoint
Here is the eventId that should've triggered the webhook: evt_1MMSYsCDFIRPxuIJq5Rex9lb
Thanks for your help!
taking a look
the event you sent is not made on the connected account but rather on your platform account
that's why you're not receiving it
const session = await stripe.checkout.sessions.create({ line_items: [ { name: "Event Ticket", amount: price * 100, currency: currency, quantity: 1, }, ], payment_intent_data: { application_fee_amount: 0, // price * 100 * 0.1, on_behalf_of: stripeAccountId, transfer_data: { destination: stripeAccountId, }, }, customer: customerId, metadata: { email: email }, mode: "payment", success_url: successUrl, cancel_url: successUrl, });
Sorry for the formatting. This is how I create the checkout. The stripeAccountId is that of the connected account.
I'm not saying your code is wrong I'm just saying that the event you sent is related to a checkout session that was created on your platform
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Is the code above the correct way for creating a checkout for a connected account?
Ok so there are 3 types of Charges and depending on the type of Charge objects get created either on the platform or on the connect account
Direct Charges for example create all objects on the connect account
while Destination Charges (including also the obo) create the objects on the Platform level
Ah I see. If I create a DirectCharge I only get a paymentIntent. How do I then return a checkoutUrl from that intent?
to create a Checkout Session with a direct charge, instead of using payment_intent_data.obo you need to pass in the stripeAccount id in the header as explained here https://stripe.com/docs/api/connected_accounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So I only need to add the stripeAccountId header to the above code?
and remove the payment_intent_data
How do I then set the platform charge? Say 5% of the payment.
oh yes you're right, then you just keep the payment_intent_data.application_fee_amount
So I've tried this```
const session = await stripe.checkout.sessions.create( { line_items: [ { name: "Event Ticket", amount: price * 100, currency: currency, quantity: 1, }, ], payment_intent_data: { application_fee_amount: 0, // price * 100 * 0.1, }, customer: customerId, metadata: { email: email }, mode: "payment", success_url: successUrl, cancel_url: successUrl, }, { stripeAccountId: stripeAccountId } );
But I'm getting an error message, is the stripeAccountId header in the correct location?
what is the request id? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
There doesn't seem to be a request id.
This is the error in my logs: Unhandled error Error: Stripe: Unknown arguments
If a place the stripeAccountId inside the create header I get this requestId: req_RwU442UOzlJU3v
I'm terribly sorry but the code is not formatted and I'm having a bit of trouble reading it
just give me a sec
Thank you. Apologies for the bad format. New to discord.
no worries
in the request you shared I saw that you still have the stripeAccount as part of your request body
you just need to remove that and keep it in the header
and you should be fine
Sorry for a very dumb question. What do you mean keep it in the header? I've moved it outside the request body, but then get an Unknown arguments error.
just give me a second I'm checking one thing for you
Thank you. Really appreciate the help.
so basically your code has stripeAccountId: stripeAccountId instead of stripeAccount: stripeAccountId which might be the reason why it's not working
Ahh let me check!
{
line_items: [
{
name: "Event Ticket",
amount: price * 100,
currency: currency,
quantity: 1,
},
],
payment_intent_data: {
application_fee_amount: 0,
},
customer: customerId,
metadata: { email: email },
mode: "payment",
success_url: successUrl,
cancel_url: successUrl,
},
{ stripeAccount: stripeAccountId }
);
That worked! Thank you so much.
no worries ๐
If you have some time can I ask you another question?
yes sure
In the checkout object I've added some metadata. But in the webhook event the metadata is empty. Any idea why?
what webhook event are you listening to?
charge.succeeded
that's not the correct event to listen to
you should be listening to checkout.session.completed