#zeke_checkout-morequestions
1 messages Β· Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- zeke_error, 18 hours ago, 10 messages
- zeke_checkout-question, 22 hours ago, 38 messages
- zeke_connect-accountlink, 1 day ago, 9 messages
- zeke_unexpected, 1 day ago, 13 messages
- zeke_error, 1 day ago, 51 messages
- zeke_ios-paymentsheet, 1 day ago, 85 messages
and 5 more
π Welcome to your new thread!
β²οΈ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
β±οΈ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1261088096901005313
π Have more to share? Add details, code, screenshots, videos, etc. below.
Hello Koopajah! im back lets figure this out!
π
BTW in the same code I showed yesterday I relized that this was at the bottom and I did not show you!
// Add createPaymentIntent
createPaymentIntent: privateProcedure
.input(
z.object({
amount: z.number(),
currency: z.string(),
accountId: z.string(),
})
)
.mutation(async ({ input }) => {
const paymentIntent = await stripe.paymentIntents.create({
amount: input.amount,
currency: input.currency,
application_fee_amount: Math.round(input.amount * 0.1), // 10% fee
transfer_data: {
destination: input.accountId,
},
});
return paymentIntent;
}),
});
I'm happy to help but I'm working with other people on complex questions. Can you please ask an exact clear question all in one message and not many short sentences?
What do you need help with?
You were asking me questions yesterday about my code because it was not showing connected accounts on my stripe logs.
Checkout Zeke_checkout-questions
yeah I remember, but I help many people all the time in parallel. So I'm asking you to try and ask me what you need now. The code you shared seems irrelevant to using Checkout. It wouldn't make any sense for you to create a PaymentIntent to accept a payment if you are using Checkout.
zeke_checkout-morequestions
Yes so I run a marketplace were other people need to be able to post products so I guess I have two questions.
-
How can i with connect have users connect accounts with stripe so they can get paid for the products they post on my application. I have some code that I thought would have worked but I dont know where to look to test it because I dont think it shows up in logs.
-
The PaymentIntent is so my application can make a profit. I am trying to take 10% of every product sold. I added it to my Paymentrouter.ts which is were StripeSession is created. Should it not be there? should it be in my server.ts?
Yeah I'm sorry I'm worried because you have done many many threads over the past few days but it unfortunately still looks like you are mixing up most concepts together entirely.
You really should consider hiring a freelancer to build this all for you at this point. I hope it's okay to say this because of all the back and forth for hours you had with my team.
Ultimately: there's absolutely no reason for you to create a PaymentIntent at all so that entire code should be deleted. You need to configure the Checkout Session to be specific to Connect + Checkout + Direct Charges here: https://docs.stripe.com/connect/enable-payment-acceptance-guide?payment-ui=stripe-hosted
ok so are you saying that should all be in one file or spread out in connecting files
I respect you saying this but im not going to give up till i figure this out. the reason im getting things mixed up is because of the files ive been sent to read. most of them look the same and I have not been told thoroughly which ones to read. ive been sent almost 10 diffrent files and ive studied everyone of them.
which leads me to get confused about what code should be implemented into my code.
So is this the only link/file I need to implement into my code?
https://docs.stripe.com/connect/enable-payment-acceptance-guide?payment-ui=stripe-hosted
yes but based on past back and forth it won't really help
Adding yet another guide and having you add even more code won't help if you don't take the time to understand things first
You are a platform. You have Standard accounts. You are using Direct Charges
What this means is that, as a developer, you are supposed to make all the request directly on the connected account. That's true for creating a Product, a Price, a Checkout Session, etc.
You were not doing that at all when we talked yesterday at least.
I recommend pausing and taking a few minutes to watch https://www.youtube.com/watch?v=dCL9adgdP0A
Don't focus on the code since it's about PaymentIntents but focus about the flow of funds and what's explained.
Once you have done that, reply to this thread and give me an exact connected account id that you are testing with (not your own) and I'll show you what to do next
Ok I watched the video! I understand the flow.
Just to make sure im doing things right this is how I got the connected account id:
Dashboard -> Connect -> connected accounts -> acct_1PajOI09PDa209NJ
Perfect! Looking at that account I see in the logs that you tried to create a Checkout Session yesterday on it but it errored because you used the transfer_data parameter (which is incompatible)
Okay, now share with me the code that creates your Checkout Session. Don't share a picture, share text
its a lot
yeah I'm sorry you really need to stop dumping dozens of lines of code
sorry
https://docs.stripe.com/api/checkout/sessions/create look at the code example here and how easy it is to create a Checkout Session
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ill delete
Your code is clearly doing a ton of things.
yes, yes it is
Let me drastically simplify your code to hardcode values. You can make it more advanced later but right now you have some weird complex product filtering and line items dyanmic creation
just hardcode a damn id π
give me a frw minutes
ok thank you
Im using payload cms for people to create products so thats why there is all those filters
yeah but you are doing way too many things at once
you really need to focus on small steps
success_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/thank-you?orderId=${order.id},
cancel_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/cart,
payment_method_types: ["card"],
mode: "payment",
metadata: {
userId: user.id,
orderId: order.id,
},
line_items: [
{
price: "price_1PVJAM05fNcBdPQgDEu0sfqT",
quantity: 1,
}
]
});
console.log("I have now created the Checkout Session ", checkoutSession.id);```
yes sir
run this code instead
ok
show me the log you get back!
req_buJ7fsz6T647aU
I had to change a little because of conficts with other files sorry that took so long!
Okay so that's step one: Checkout works on your own account, without anything Connect related.
Now let's try to create the same Checkout Session on the connected account. All you need to do is explicitly tell us which connected account to make the request on. This is done with the API feature documented here: https://stripe.com/docs/connect/authentication#stripe-account-header
So now take the code you tweaked, and add an extra option as a parameter to the Checkout Session creation:
success_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/thank-you?orderId=${order.id},
cancel_url: ${process.env.NEXT_PUBLIC_SERVER_URL}/cart,
payment_method_types: ["card"],
mode: "payment",
metadata: {
userId: user.id,
orderId: order.id,
},
line_items: [
{
price: "price_1PVJAM05fNcBdPQgDEu0sfqT",
quantity: 1,
}
]
},
{
stripeAccount: 'acct_1PajOI09PDa209NJ',
}
);
console.log("I have now created the Checkout Session ", checkoutSession.id);```
This code **will fail**, it's expected. Just try it and tell me what error you get
ok so ive added the code. the only thing that has changed is the line_items
I mean did you explicitly add that stripeAccount part?
show me your current code after the change
req_UlGYG5TlC2Yz99
yes i did
here is the error: resource_missing - line_items[0][price]
No such price: 'price_1PVJAM05fNcBdPQgDEu0sfqT'
Success
So now you, as a developer have made a real Connect request. The problem is that you are telling Stripe "Please create a Checkout Session for the Price price_1PVJAM05fNcBdPQgDEu0sfqT on the connected account acct_1PajOI09PDa209NJ"
and Stripe says "well I'm sorry but I have never heard of the Price price_1PVJAM05fNcBdPQgDEu0sfqT on acct_1PajOI09PDa209NJ"
yes
And now you are getting at the root of Direct Charges. You are a platform but you make requests on a different Stripe account. And you have to make sure that you reference object ids from that Stripe account, not from your own
Does that make sense?
yes i believe I understand
Cool, so now the next step is to create a Product and a Price on that connected account.
You wouldn't do this for each Checkout Session. The connected account is selling certain products and you would have another part of your code/set up that would create all of those for you.
Do you have something like this already?
Yes i probably do what am I looking for specifically
A call to the Create Product and/or Create Price APIs: https://docs.stripe.com/api/products/create https://docs.stripe.com/api/prices/create
I did in the old code but i deleted it let me go to my repo rq
well would be easier to do this as a one off
yeah
do you mean something like this?
line_items.push({
price: "price_1OCeBwA19umTXGu8s4p2G3aX",
quantity: 1,
adjustable_quantity: {
enabled: false,
},
this is not my price anymore btw this is an old ID
lol you're back with your line_items.push() I explicitly try to remove π
You are a developer, you are writing lots of code. This is going to take you weeks
What I am saying is right now we need a real Price id price_123 on that connected account. Later you will write an entire feature to import someone's products from their own product catalog.
Right now all you need to do is write code that you will use once to create a Product and a Price on that connected account
yep once you have one, give it to me and I can check that you created it properly
nope this is wrong
product or price id?
I mean you didn't really internalize what I explained for the past 2 hours π
as far as I can tell you went in your own Dashboard and manually created a Price in your own Stripe account. Is that correct?
yes I went to product -> create a new product and made a new one
and Stripe says "well I'm sorry but I have never heard of the Price price_1PVJAM05fNcBdPQgDEu0sfqT on acct_1PajOI09PDa209NJ"```
I thought thats how it worked?
I explicitly explained this in heavy details and I assume you didn't understand that part at all yet
I'm sorry, this is getting... unwieldy. Those are really simple concepts and if you don't grasp those (which really is totally fine and not your fault) you are going to spent months on this basic feature. You really need to hire a professional to do this for you π
NO I read that wrong the first time around!
Im dyslexic please excuse me I read stuff wrong some times!
when I read too quick I missunded stand things im with you know!
I understand now
all good, just explaining that this is getting tricky overall. My team helps hundreds of developers a month and we unfortunately can't spend dozens of hours 1:1 with people.
So how does one create a price_id for a connected account? its not like I can access someones connect account right?
4:36 PM]koopajah: Now let's try to create the same Checkout Session on the connected account. All you need to do is explicitly tell us which connected account to make the request on. This is done with the API feature documented here: https://stripe.com/docs/connect/authentication#stripe-account-header
I explained that concept in details on the previous part of the conversation.
You use that feature to make any API Request on a connected account.
I am actively helping you. It's been 90 minutes non stop. But I do need you to try and do some of the debugging/understanding too.
So I explained before how to do this, so what part is unclear?
Ok sir im going to log off now! I really appreciate your help and sitting here with me! ill stop spamming you guys! thanks.