#rhuzaifa_error
1 messages ยท Page 1 of 1 (latest)
๐ 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/1329810666474967071
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- rhuzaifa_code, 2 hours ago, 18 messages
- rhuzaifa_docs, 2 days ago, 6 messages
- rhuzaifa_docs, 3 days ago, 19 messages
- rhuzaifa_webhooks, 4 days ago, 27 messages
- rhuzaifa_webhooks, 4 days ago, 23 messages
My fixture
// fixture.json
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "checkout_session",
"path": "/v1/checkout/sessions",
"method": "post",
"params": {
"payment_method_types": [
"card"
],
"mode": "subscription",
"line_items": [
{
"price": "REPLACE_VIA_CLI",
"quantity": 1
}
],
"success_url": "REPLACE_VIA_CLI",
"cancel_url": "REPLACE_VIA_CLI",
"customer": "REPLACE_VIA_CLI",
"custom_text": {
"terms_of_service_acceptance": {
"message": "I accept ${.env:APP_NAME}'s terms of service."
}
},
"consent_collection": {
"terms_of_service": "required"
},
"metadata": {
"user_id": "REPLACE_VIA_CLI"
}
}
},
{
"name": "payment_page",
"path": "/v1/payment_pages/${checkout_session:id}",
"method": "get"
},
{
"name": "payment_page_confirm",
"path": "/v1/payment_pages/${checkout_session:id}/confirm",
"method": "post",
"params": {
"payment_method": "REPLACE_VIA_CLI",
"expected_amount": "REPLACE_VIA_CLI"
}
}
]
}
how i use it
stripe trigger checkout_sessions_completed.json --override checkout_session:"line_items[0][price]"=price_1QBz8wHj8xfC0YnCWyWxyUQI --override checkout_session:"success_url"='http://localhost:3000//subscription/success?session_id={CHECKOUT_SESSION_ID}' --override checkout_session:"cancel_url"='http://localhost:3000//pricing' --override checkout_session:"customer"=cus_RbSpK1ggiOK989 --override checkout_session:"metadata[user_id]"=19 --override payment_page_confirm:"payment_method"=pm_1QiFu0Hj8xfC0YnCiX1roq1Z --override payment_page_confirm:"expected_amount"=2900
the error i get
A newer version of the Stripe CLI is available, please update to: v1.23.3
Setting up fixture for: checkout_session
Running fixture for: checkout_session
Trigger failed: Request failed, status=400, body={
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such price: 'REPLACE_VIA_CLI'",
"param": "line_items[0][price]",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_Unme2EPH1frfOC?t=1737121693",
"type": "invalid_request_error"
}
}
s
๐ Checking...
For metadat you should use --override checkout_session:"metadata.user_id"=19
Checking why the price isn't getting overridden...
This should work:
stripe trigger your_fixture --override "checkout_session:line_items[0].price=price_abc"
trying...
Worth noting that line_items field won't be in the event payload though
is this only in the case of running fixtures, when the values are overridden with cli?
During the API request of the session create
The line_items field will reflect the values you pass, but they're just not expanded on the resource by default so not included in webhook payloads. Nothing CLI specific, that's how the API works
ok yeah, makes sense.
"checkout_session:line_items[0].price=price_abc"
this worked. Thanks, but now i am getting this error
Setting up fixture for: checkout_session
Running fixture for: checkout_session
Setting up fixture for: payment_page
Running fixture for: payment_page
Setting up fixture for: payment_page_confirm
Running fixture for: payment_page_confirm
Trigger failed: Request failed, status=400, body={
"error": {
"message": "An error has occurred confirming the Checkout Session.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_A0HfEjh6koKjfK?t=1737123793",
"type": "invalid_request_error"
}
}
Well this is because it's an internal API that shouldn't really be used like this
payment_pages/:id/confirm that is
but it exits in the stripe cli trigger examples, so shouldn't it work?
A command-line tool for Stripe. Contribute to stripe/stripe-cli development by creating an account on GitHub.
it actually works without overrides
if i hardcode the values in fxtures
As I said, internal API that yes the CLI leverages.
Looking at the request to see what the issue is
OK, I think it's because there's no email set on the pm_xxx you're using
hm, i actually have set the email on customer so i thought it would reuse that. Going to try setting email on pm_
i don't think i can set the email on payment method, i am actually attaching a test card via its token like this
// nodejs
const paymentMethod = await stripe.paymentMethods.attach(`pm_card_visa`, {
customer: customer.id,
})
Yes you'll probably need to update the resulting pm_xxx and set a billing_details[email]: https://docs.stripe.com/api/payment_methods/update#update_payment_method-billing_details-email
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
See the CLI default fixture for inspiration: https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/checkout.session.completed.json#L68
Will likely need a country and ZIP code too
hm, taking a look and trying it out
Worked smoothly. Thanks!
I had some feedback about the docs: This (https://docs.stripe.com/stripe-cli/triggers#customize-events) section references line_items[0][price] which caused my original confusion, when as you mentioned it should be line_items[0].price
To be fair, checkout_session:line_items[0][price] also works
maybe i am on the wrong cli version? its 1.21.10
You just need quotes around the value too
Looks like you didn't initially:
checkout_session:"line_items[0][price]"=price_1QBz8wHj8xfC0YnCWyWxyUQI --override
i see, makes sense. Thanks!