#hero_cli-override

1 messages ยท Page 1 of 1 (latest)

gentle martenBOT
brave bluffBOT
#

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.

gentle martenBOT
#

๐Ÿ‘‹ 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/1256001381446455297

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

sharp marlin
#

hero_cli-override

shut delta
#

okay then maybe im a little bit lost which resouce and property i need to override for that. Can you help me with this one?

sharp marlin
#

Sure, can you share an exact command you use so I can show you what to change?

shut delta
#
stripe trigger checkout.session.completed \
  --override checkout_session:customer=cus_xxx

That my current command

#

I now dont want to create a price and product each time i trigger that webhook and instead use my own price id

sharp marlin
#

sounds good, give me a few minutes and I'll show you

shut delta
#

Thanks ๐Ÿ™‚

sharp marlin
#

Okay so when you use that trigger what we do is run a sequence of API requests that are defined in the following file https://github.com/stripe/stripe-cli/blob/7d26bb96aa0728777b0291f66f8d1ab4597570b6/pkg/fixtures/triggers/checkout.session.completed.json

What your command does is exactly that but you are overriding the Customer id in the checkout_session creation step. So basically you are forcing your parameter in this list of parameters https://github.com/stripe/stripe-cli/blob/7d26bb96aa0728777b0291f66f8d1ab4597570b6/pkg/fixtures/triggers/checkout.session.completed.json#L29

And so now what you want is also override the Price id that is inside line_items.

When I debug those what I do is use a fake Price id so that if the parameter I passed is used properly then I get an error because the Price id doesn't exist. That lets me try various approaches until one works.

Here's what you want stripe trigger checkout.session.completed --override checkout_session:"line_items[0][price]"=price_ABC

shut delta
#

I just tried it out and it seems not to work. It still is creating price and product and using the new create price id

stripe trigger checkout.session.completed \
  --override checkout_session:customer=cus_ABC \
  --override checkout_session:"line_items[0][price]"=price_ABC

That my current command

sharp marlin
#

can you try without customer just to confirm?

shut delta
#

sure

#
Trigger failed: Request failed, status=400, body={
  "error": {
    "code": "checkout_amount_mismatch",
    "message": "Your purchase session has changed. Please review the updated total and submit payment again.",
    "param": "expected_amount",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_ABC",
    "type": "invalid_request_error"
  }
}

I overlocked an error when creating the trigger
That error also happends with just the line items override command

stripe trigger checkout.session.completed --override checkout_session:"line_items[0][price]"=price_ABC
sharp marlin
shut delta
#

I got it, i will try

#
stripe trigger checkout.session.completed \
  --override checkout_session:"line_items[0][price]"=price_ABC \
  --override payment_page_confirm:expected_amount=425000

I still get that error even after overriding the expected_amount
The price amount is 4250,00 โ‚ฌ
Maybe my amount is wrong?

sharp marlin
#

not sure sorry, would help to get real exact error, exact object ids, etc. at this point

my advice: stop using the CLI for this, you're going to get grey hair before you succeed with all the edge-cases. Use the API, create a Checkout Session and complete it in the browser

shut delta
#

Okay, Thanks for your help. I will use your advice and create me a fast checkout creation process for testing

sharp marlin
#

you can also make your own trigger so that you can pass the exact parameters you care about otherwise

shut delta
#

Oh thats also an option. Do you got some docs link for me about that?

#

I think i found it

#

Thanks for your help ๐Ÿ™‚