#mechanic_checkout-fixture
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.
- geeky-mechanic_api, 1 day ago, 31 messages
- geeky_cli-fixtures, 2 days ago, 14 messages
đ 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.
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
So there is isn't an all-around way to test my integration?
This is kind of a bummer, this guide proposed to listen to this event and then test it out :
https://docs.stripe.com/connect/separate-charges-and-transfers?platform=web&ui=stripe-hosted#test-the-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^
Correct there isn't. We really discourage using the CLI to run unit tests or whatever. And the CLI can't test everything and some of it you have to go through by hand.
the override wouldn't work for async, not reliably at least in the way you asked.
Like we do have a fixture https://github.com/stripe/stripe-cli/blob/7d26bb96aa0728777b0291f66f8d1ab4597570b6/pkg/fixtures/triggers/checkout.session.async_payment_succeeded.json already based on SEPA Debit but I assumed you tried that already
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
ah then I misunderstood what you asked I think
You want to set payment_intent_data[transfer_group] like https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_group right? If so override should work fine
Yeah, basically what I need is to have specific LineItems, Session id, transfer group
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
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!
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
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
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
I see what you mean, I will look into the fixture and maybe change my testing approach!
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.