#mechanic_checkout-fixture

1 messages ¡ Page 1 of 1 (latest)

waxen ferryBOT
true ospreyBOT
#

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.

waxen 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/1235374778940915782

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

radiant quartz
#

mechanic_checkout-fixture

#

@unreal oar there isn't really a way with the CLI so you can't. The best option is to create a real Checkout Session in your account and then put all the information you are after in that case

unreal oar
#

So there is isn't an all-around way to test my integration?

#

Which actually only tests a part of the process

#

Could using the --add or the --override flags in the Stripe cli permit me to edit some specific data created by the cli^

radiant quartz
unreal oar
#

Yeah, I used the --edit flag which let me edit some of the data which looked about the same, but the thing is that I need to get some crucial info for transfers like the transfer group (which refers to some info in my db)!

#

I can test without using the webhook, and directly call the function, I'm just uneasy about not testing it

radiant quartz
#

ah then I misunderstood what you asked I think

unreal oar
#

Yeah, basically what I need is to have specific LineItems, Session id, transfer group

radiant quartz
#

hum

#

So yeah sorry, if all you want is get a Checkout Session object that has the right information for a Destination Charge for example then this is totally doable. What you need to

#

I stopped typing that when you said that sentnece

#

impossible to pick the id

unreal oar
#

Okay, then maybe you can help me further, give me a minute to explain better my integration

#

Basically I'm doing separate charges and transfers as a single charge can have parts going to multiple connected accounts. When doing so I set a transfer group to the payment intent which represents the id of the order that was registered in my db. Then when the webhook hits, I need to get the subtotal (before taxes) of the transaction and the stripe fee to split the amount correctly. After that I need to get the LineItems, as each line item can be owned by a different merchant (as defined in my database) which in turn has a connected account. And then I need to initiate a transfer to each of these merchants by getting their Connect account ID from my db. Now this is why it is crucial to have some specific info, as some fields have to match my db records!

radiant quartz
#

Sure but then you don't need id or line items really

#

But ultimately: take the fixture I linked and make you own with the API parameters your real code would set

unreal oar
#

Well, yeah, because my only way of separating the parts is through the line items because it is possible that each product is owned by a different merchant for a specific order, and so I need to calculate who is owed what

radiant quartz
#

Sure but it's just a test you're doing, you should be able to just pretend in your code

#

but you have full control over those parameters so that seems to be totally doable

unreal oar
#

I see what you mean, I will look into the fixture and maybe change my testing approach!

radiant quartz
#

yeah I just tried locally. I downloaded the fixture, then I edited the line here to add transfer_group like this:

          "transfer_group": "MYVALUE",
          "setup_future_usage": "off_session",
          "shipping": {``` and the resulting PaymentIntent has it as expected
#

you can configure your lines, create Products/Prices or hardcode ids, etc.

true ospreyBOT